Skip to content

Commit

Permalink
Improve handling of gpu options
Browse files Browse the repository at this point in the history
  • Loading branch information
taylor-a-barnes committed Oct 7, 2024
1 parent 96e4c29 commit 71529c1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
3 changes: 2 additions & 1 deletion mdimechanic/cmd_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ def run( script_name, base_path ):
'''.format(**textargs)

if 'gpu' in mdimechanic_yaml['docker']:
docker_compose_text += '''deploy:
docker_compose_text += '''
deploy:
resources:
reservations:
devices:
Expand Down
16 changes: 12 additions & 4 deletions mdimechanic/utils/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,13 @@ def test_validate( base_path ):


def test_min( base_path ):
mdimechanic_yaml = get_mdimechanic_yaml( base_path )

# Get the path to the docker-compose file
docker_path = get_compose_path( "tcp" )
if 'gpu' in mdimechanic_yaml['docker']:
docker_path = get_compose_path( "tcp_nvidia" )
else:
docker_path = get_compose_path( "tcp" )

# Write the run script for MDI Mechanic
docker_file = os.path.join( base_path, ".mdimechanic", ".temp", "docker_mdi_mechanic.sh" )
Expand All @@ -57,7 +62,6 @@ def test_min( base_path ):

# Write the run script for the engine
# NOTE: NEED TO LOOP OVER ALL AVAIALBLE TEST SCRIPTS
mdimechanic_yaml = get_mdimechanic_yaml( base_path )
script_lines = mdimechanic_yaml['engine_tests']['script']
script = "#!/bin/bash -l\nset -e\ncd /repo\n"
script += "export MDI_OPTIONS=\'-role ENGINE -name TESTCODE -method TCP -hostname mdi_mechanic -port 8021\'\n"
Expand Down Expand Up @@ -105,8 +109,13 @@ def test_min( base_path ):
docker_error( down_tup, "Minimal MDI functionality test returned non-zero exit code on docker down." )

def test_unsupported( base_path ):
mdimechanic_yaml = get_mdimechanic_yaml( base_path )

# Get the path to the docker-compose file
docker_path = get_compose_path( "tcp" )
if 'gpu' in mdimechanic_yaml['docker']:
docker_path = get_compose_path( "tcp_nvidia" )
else:
docker_path = get_compose_path( "tcp" )

# Write the run script for MDI Mechanic
docker_file = os.path.join( base_path, ".mdimechanic", ".temp", "docker_mdi_mechanic.sh" )
Expand All @@ -130,7 +139,6 @@ def test_unsupported( base_path ):
# "./run.sh\n"]
#os.makedirs(os.path.dirname(docker_file), exist_ok=True)
# NOTE: NEED TO LOOP OVER ALL AVAIALBLE TEST SCRIPTS
mdimechanic_yaml = get_mdimechanic_yaml( base_path )
script_lines = mdimechanic_yaml['engine_tests']['script']
script = "#!/bin/bash -l\nset -e\ncd /repo\n"
script += "export MDI_OPTIONS=\'-role ENGINE -name TESTCODE -method TCP -hostname mdi_mechanic -port 8021\'\n"
Expand Down

0 comments on commit 71529c1

Please sign in to comment.