Skip to content
Snippets Groups Projects
Commit c2af726f authored by Kenny Sharma's avatar Kenny Sharma
Browse files

[hotfix] Staging launch requires valid NRP_VARIABLES_PATH file.

This patch changes the Lugano launch configuration to deploy the
nrp-variables script generated by Puppet to the remote hosts and
properly override NRP_VARIABLES_PATH to ensure Gazebo launch succeeds.

The previous version only set the _VERSION variables, but the file is
required to be accessible for the Gazebo launch to succeed in a staging
environment.

Change-Id: I06ec74420fdd35d3219ee311531aa8d57504936b
parent 40cc03d1
No related branches found
No related tags found
No related merge requests found
...@@ -68,19 +68,16 @@ class LuganoLauncher(LuganoVizCluster, LocalLauncher): ...@@ -68,19 +68,16 @@ class LuganoLauncher(LuganoVizCluster, LocalLauncher):
# create a launch script that configures the vizcluster environment properly # create a launch script that configures the vizcluster environment properly
with open(path, 'w') as f: with open(path, 'w') as f:
f.write('#!/bin/bash\n') f.write('#!/bin/bash\n')
f.write('source /opt/rh/python27/enable\n')
# set the terminal type to ensure we get the same behavior as from a backend VM # set the terminal type to ensure we get the same behavior as from a backend VM
# this is also required in the Docker images # this is also required in the Docker images
f.write('export TERM=linux\n') f.write('export TERM=linux\n')
# environment variable configuration # set the environment version and any specific module versions to be used, then
f.write('source /opt/rh/python27/enable\n') # override the environment variable to the deployed location on the remote host
f.write('export ENVIRONMENT=%s\n' % environment) f.write('source $NRP_MUSIC_DIRECTORY/nrp-variables\n')
if environment == 'staging': f.write('export NRP_VARIABLES_PATH=$NRP_MUSIC_DIRECTORY/nrp-variables\n')
with open(os.environ.get('NRP_VARIABLES_PATH')) as f:
content = f.readlines()
for version in [x.strip() for x in content if '_VERSION=' in x]:
f.write('%s\n' % version)
# load the environment modules based on the above configuration # load the environment modules based on the above configuration
proj_path = '/gpfs/bbp.cscs.ch/project/proj30/neurorobotics/%s/' % environment proj_path = '/gpfs/bbp.cscs.ch/project/proj30/neurorobotics/%s/' % environment
...@@ -101,6 +98,7 @@ class LuganoLauncher(LuganoVizCluster, LocalLauncher): ...@@ -101,6 +98,7 @@ class LuganoLauncher(LuganoVizCluster, LocalLauncher):
# actually launch the module # actually launch the module
f.write('python -m {module}\n'.format(module=module)) f.write('python -m {module}\n'.format(module=module))
# ensure the script is executable
os.chmod(path, stat.S_IRWXU) os.chmod(path, stat.S_IRWXU)
# return a relative path to the script, it's guaranteed to be run in the tmpdir # return a relative path to the script, it's guaranteed to be run in the tmpdir
...@@ -111,8 +109,15 @@ class LuganoLauncher(LuganoVizCluster, LocalLauncher): ...@@ -111,8 +109,15 @@ class LuganoLauncher(LuganoVizCluster, LocalLauncher):
Copy all configuration files to a temp directory on the remote host. The remote directory Copy all configuration files to a temp directory on the remote host. The remote directory
is created here, so use it to set the launcher interface host tmpdir value. is created here, so use it to set the launcher interface host tmpdir value.
""" """
# generated configuration files
for f in os.listdir(self._local_tmpdir): for f in os.listdir(self._local_tmpdir):
self._copy_to_remote(os.path.join(self._local_tmpdir, f)) self._copy_to_remote(os.path.join(self._local_tmpdir, f))
# deploy any NRP specific variable/module version configuration
self._copy_to_remote(os.environ.get('NRP_VARIABLES_PATH'))
# set the host tmpdir, slightly different naming convention between interfaces
self._host_tmpdir = self._tmp_dir self._host_tmpdir = self._tmp_dir
def shutdown(self): def shutdown(self):
......
...@@ -54,9 +54,10 @@ class TestLuganoLauncherInterface(unittest.TestCase): ...@@ -54,9 +54,10 @@ class TestLuganoLauncherInterface(unittest.TestCase):
handle = m() handle = m()
self.assertEqual(handle.write.call_args_list, self.assertEqual(handle.write.call_args_list,
[call('#!/bin/bash\n'), [call('#!/bin/bash\n'),
call('export TERM=linux\n'),
call('source /opt/rh/python27/enable\n'), call('source /opt/rh/python27/enable\n'),
call('export ENVIRONMENT=dev\n'), call('export TERM=linux\n'),
call('source $NRP_MUSIC_DIRECTORY/nrp-variables\n'),
call('export NRP_VARIABLES_PATH=$NRP_MUSIC_DIRECTORY/nrp-variables\n'),
call('source /gpfs/bbp.cscs.ch/project/proj30/neurorobotics/dev//server-scripts/nrp-services-modules.sh\n'), call('source /gpfs/bbp.cscs.ch/project/proj30/neurorobotics/dev//server-scripts/nrp-services-modules.sh\n'),
call('export NRP_MODELS_DIRECTORY=/gpfs/bbp.cscs.ch/project/proj30/neurorobotics/dev//models\n'), call('export NRP_MODELS_DIRECTORY=/gpfs/bbp.cscs.ch/project/proj30/neurorobotics/dev//models\n'),
call('export NRP_EXPERIMENTS_DIRECTORY=/gpfs/bbp.cscs.ch/project/proj30/neurorobotics/dev//experiments\n'), call('export NRP_EXPERIMENTS_DIRECTORY=/gpfs/bbp.cscs.ch/project/proj30/neurorobotics/dev//experiments\n'),
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment