Loading README.md +3 −2 Original line number Diff line number Diff line Loading @@ -45,7 +45,9 @@ Clean Example Webapp configuraion - SAFEMODE=False - DJANGO_LOG_LEVEL=CRITICAL - DJANGO_DEV_SERVER=True - DJANGO_DEBUG=True - DJANGO_LOG_LEVEL=ERROR - ROSETTA_LOG_LEVEL=ERROR - ROSETTA_TUNNEL_HOST=localhost # Not http or https - ROSETTA_WEBAPP_HOST= Loading @@ -58,7 +60,6 @@ Example Webapp configuraion - DJANGO_PUBLIC_HTTP_HOST=http://localhost # Public facing, with http or https ### Extras List all running services Loading docker-compose-dev.yml +1 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ services: hostname: webapp environment: - SAFEMODE=False - DJANGO_DEV_SERVER=True - DJANGO_DEBUG=True - DJANGO_LOG_LEVEL=CRITICAL - ROSETTA_LOG_LEVEL=DEBUG Loading services/webapp/code/rosetta/core_app/api.py +54 −74 Original line number Diff line number Diff line Loading @@ -209,7 +209,6 @@ class UserViewSet(viewsets.ModelViewSet): class agent_api(PublicGETAPI): def _get(self, request): try: task_uuid = request.GET.get('task_uuid', None) if not task_uuid: Loading Loading @@ -326,23 +325,4 @@ print(port) return HttpResponse('Unknown action "{}"'.format(action)) except Exception as e: logger.error(e) services/webapp/code/rosetta/core_app/computing_managers.py +9 −9 Original line number Diff line number Diff line Loading @@ -205,7 +205,7 @@ class RemoteComputingManager(ComputingManager): else: binds += ',{}'.format(task.extra_binds) run_command = 'ssh -i {} -4 -o StrictHostKeyChecking=no {}@{} '.format(user_keys.private_key_file, user, host) run_command = 'ssh -o LogLevel=ERROR -i {} -4 -o StrictHostKeyChecking=no {}@{} '.format(user_keys.private_key_file, user, host) run_command += '/bin/bash -c \'"rm -rf /tmp/{}_data && mkdir -p /tmp/{}_data/tmp && mkdir -p /tmp/{}_data/home && chmod 700 /tmp/{}_data && '.format(task.uuid, task.uuid, task.uuid, task.uuid) run_command += 'wget {}/api/v1/base/agent/?task_uuid={} -O /tmp/{}_data/agent.py &> /dev/null && export BASE_PORT=\$(python /tmp/{}_data/agent.py 2> /tmp/{}_data/task.log) && '.format(webapp_conn_string, task.uuid, task.uuid, task.uuid, task.uuid) run_command += 'export SINGULARITY_NOHTTPS=true && export SINGULARITYENV_BASE_PORT=\$BASE_PORT && {} '.format(authstring) Loading Loading @@ -262,7 +262,7 @@ class RemoteComputingManager(ComputingManager): user = task.computing.get_conf_param('user') # Stop the task remotely stop_command = 'ssh -i {} -4 -o StrictHostKeyChecking=no {}@{} \'/bin/bash -c "kill -9 {}"\''.format(user_keys.private_key_file, user, host, task.pid) stop_command = 'ssh -o LogLevel=ERROR -i {} -4 -o StrictHostKeyChecking=no {}@{} \'/bin/bash -c "kill -9 {}"\''.format(user_keys.private_key_file, user, host, task.pid) out = os_shell(stop_command, capture=True) if out.exit_code != 0: if not 'No such process' in out.stderr: Loading @@ -286,7 +286,7 @@ class RemoteComputingManager(ComputingManager): user = task.computing.get_conf_param('user') # View log remotely view_log_command = 'ssh -i {} -4 -o StrictHostKeyChecking=no {}@{} \'/bin/bash -c "cat /tmp/{}_data/task.log"\''.format(user_keys.private_key_file, user, host, task.uuid) view_log_command = 'ssh -o LogLevel=ERROR -i {} -4 -o StrictHostKeyChecking=no {}@{} \'/bin/bash -c "cat /tmp/{}_data/task.log"\''.format(user_keys.private_key_file, user, host, task.uuid) out = os_shell(view_log_command, capture=True) if out.exit_code != 0: Loading Loading @@ -364,7 +364,7 @@ class SlurmComputingManager(ComputingManager): else: binds += ',{}'.format(task.extra_binds) run_command = 'ssh -i {} -4 -o StrictHostKeyChecking=no {}@{} '.format(user_keys.private_key_file, user, host) run_command = 'ssh -o LogLevel=ERROR -i {} -4 -o StrictHostKeyChecking=no {}@{} '.format(user_keys.private_key_file, user, host) run_command += '\'bash -c "echo \\"#!/bin/bash\nwget {}/api/v1/base/agent/?task_uuid={} -O \$HOME/agent_{}.py &> \$HOME/{}.log && export BASE_PORT=\\\\\\$(python \$HOME/agent_{}.py 2> \$HOME/{}.log) && '.format(webapp_conn_string, task.uuid, task.uuid, task.uuid, task.uuid, task.uuid) run_command += 'export SINGULARITY_NOHTTPS=true && export SINGULARITYENV_BASE_PORT=\\\\\\$BASE_PORT && {} '.format(authstring) run_command += 'rm -rf /tmp/{}_data && mkdir -p /tmp/{}_data/tmp &>> \$HOME/{}.log && mkdir -p /tmp/{}_data/home &>> \$HOME/{}.log && chmod 700 /tmp/{}_data && '.format(task.uuid, task.uuid, task.uuid, task.uuid, task.uuid, task.uuid) Loading Loading @@ -431,7 +431,7 @@ class SlurmComputingManager(ComputingManager): user = task.computing.get_conf_param('user') # Stop the task remotely stop_command = 'ssh -i {} -4 -o StrictHostKeyChecking=no {}@{} \'/bin/bash -c "scancel {}"\''.format(user_keys.private_key_file, user, host, task.pid) stop_command = 'ssh -o LogLevel=ERROR -i {} -4 -o StrictHostKeyChecking=no {}@{} \'/bin/bash -c "scancel {}"\''.format(user_keys.private_key_file, user, host, task.pid) out = os_shell(stop_command, capture=True) if out.exit_code != 0: raise Exception(out.stderr) Loading @@ -454,7 +454,7 @@ class SlurmComputingManager(ComputingManager): user = task.computing.get_conf_param('user') # View log remotely view_log_command = 'ssh -i {} -4 -o StrictHostKeyChecking=no {}@{} \'/bin/bash -c "cat \$HOME/{}.log"\''.format(user_keys.private_key_file, user, host, task.uuid) view_log_command = 'ssh -o LogLevel=ERROR -i {} -4 -o StrictHostKeyChecking=no {}@{} \'/bin/bash -c "cat \$HOME/{}.log"\''.format(user_keys.private_key_file, user, host, task.uuid) out = os_shell(view_log_command, capture=True) if out.exit_code != 0: Loading Loading @@ -518,7 +518,7 @@ class RemotehopComputingManager(ComputingManager): else: binds += ',{}'.format(task.extra_binds) run_command = 'ssh -i {} -4 -o StrictHostKeyChecking=no {}@{} '.format(user_keys.private_key_file, first_user, first_host) run_command = 'ssh -o LogLevel=ERROR -i {} -4 -o StrictHostKeyChecking=no {}@{} '.format(user_keys.private_key_file, first_user, first_host) run_command += '"ssh -4 -o StrictHostKeyChecking=no {}@{} /bin/bash -c \''.format(second_user, second_host) if use_agent: Loading Loading @@ -592,7 +592,7 @@ class RemotehopComputingManager(ComputingManager): second_user = task.computing.get_conf_param('second_user') # Stop the task remotely stop_command = 'ssh -i {} -4 -o StrictHostKeyChecking=no {}@{} '.format(user_keys.private_key_file, first_user, first_host) stop_command = 'ssh -o LogLevel=ERROR -i {} -4 -o StrictHostKeyChecking=no {}@{} '.format(user_keys.private_key_file, first_user, first_host) stop_command += '"ssh -4 -o StrictHostKeyChecking=no {}@{} '.format(second_user, second_host) stop_command += 'kill -9 {}"'.format(task.pid) Loading Loading @@ -621,7 +621,7 @@ class RemotehopComputingManager(ComputingManager): second_user = task.computing.get_conf_param('second_user') # View log remotely view_log_command = 'ssh -i {} -4 -o StrictHostKeyChecking=no {}@{} '.format(user_keys.private_key_file, first_user, first_host) view_log_command = 'ssh -o LogLevel=ERROR -i {} -4 -o StrictHostKeyChecking=no {}@{} '.format(user_keys.private_key_file, first_user, first_host) view_log_command += '"ssh -4 -o StrictHostKeyChecking=no {}@{} '.format(second_user, second_host) view_log_command += 'cat \\\\\\$HOME/{}.log"'.format(task.uuid) Loading services/webapp/code/rosetta/core_app/decorators.py +13 −17 Original line number Diff line number Diff line Loading @@ -51,18 +51,16 @@ def public_view(wrapped_view): error_text = str(e) else: # Raise te exception if we are in debug mode # Log the exception logger.error(format_exception(e)) # Raise the exception if we are in debug mode if settings.DEBUG: raise # Otherwise, # Otherwise, mask it else: # first log the exception logger.error(format_exception(e)) # and then mask it. error_text = 'something went wrong' error_text = 'something went wrong ({})'.format(e) data = {'user': request.user, 'title': 'Error', Loading Loading @@ -111,18 +109,16 @@ def private_view(wrapped_view): error_text = str(e) else: # Raise te exception if we are in debug mode # Log the exception logger.error(format_exception(e)) # Raise the exception if we are in debug mode if settings.DEBUG: raise # Otherwise, # Otherwise, mask it else: # first log the exception logger.error(format_exception(e)) # and then mask it. error_text = 'something went wrong' error_text = 'something went wrong ({})'.format(e) data = {'user': request.user, 'title': 'Error', Loading Loading
README.md +3 −2 Original line number Diff line number Diff line Loading @@ -45,7 +45,9 @@ Clean Example Webapp configuraion - SAFEMODE=False - DJANGO_LOG_LEVEL=CRITICAL - DJANGO_DEV_SERVER=True - DJANGO_DEBUG=True - DJANGO_LOG_LEVEL=ERROR - ROSETTA_LOG_LEVEL=ERROR - ROSETTA_TUNNEL_HOST=localhost # Not http or https - ROSETTA_WEBAPP_HOST= Loading @@ -58,7 +60,6 @@ Example Webapp configuraion - DJANGO_PUBLIC_HTTP_HOST=http://localhost # Public facing, with http or https ### Extras List all running services Loading
docker-compose-dev.yml +1 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ services: hostname: webapp environment: - SAFEMODE=False - DJANGO_DEV_SERVER=True - DJANGO_DEBUG=True - DJANGO_LOG_LEVEL=CRITICAL - ROSETTA_LOG_LEVEL=DEBUG Loading
services/webapp/code/rosetta/core_app/api.py +54 −74 Original line number Diff line number Diff line Loading @@ -209,7 +209,6 @@ class UserViewSet(viewsets.ModelViewSet): class agent_api(PublicGETAPI): def _get(self, request): try: task_uuid = request.GET.get('task_uuid', None) if not task_uuid: Loading Loading @@ -326,23 +325,4 @@ print(port) return HttpResponse('Unknown action "{}"'.format(action)) except Exception as e: logger.error(e)
services/webapp/code/rosetta/core_app/computing_managers.py +9 −9 Original line number Diff line number Diff line Loading @@ -205,7 +205,7 @@ class RemoteComputingManager(ComputingManager): else: binds += ',{}'.format(task.extra_binds) run_command = 'ssh -i {} -4 -o StrictHostKeyChecking=no {}@{} '.format(user_keys.private_key_file, user, host) run_command = 'ssh -o LogLevel=ERROR -i {} -4 -o StrictHostKeyChecking=no {}@{} '.format(user_keys.private_key_file, user, host) run_command += '/bin/bash -c \'"rm -rf /tmp/{}_data && mkdir -p /tmp/{}_data/tmp && mkdir -p /tmp/{}_data/home && chmod 700 /tmp/{}_data && '.format(task.uuid, task.uuid, task.uuid, task.uuid) run_command += 'wget {}/api/v1/base/agent/?task_uuid={} -O /tmp/{}_data/agent.py &> /dev/null && export BASE_PORT=\$(python /tmp/{}_data/agent.py 2> /tmp/{}_data/task.log) && '.format(webapp_conn_string, task.uuid, task.uuid, task.uuid, task.uuid) run_command += 'export SINGULARITY_NOHTTPS=true && export SINGULARITYENV_BASE_PORT=\$BASE_PORT && {} '.format(authstring) Loading Loading @@ -262,7 +262,7 @@ class RemoteComputingManager(ComputingManager): user = task.computing.get_conf_param('user') # Stop the task remotely stop_command = 'ssh -i {} -4 -o StrictHostKeyChecking=no {}@{} \'/bin/bash -c "kill -9 {}"\''.format(user_keys.private_key_file, user, host, task.pid) stop_command = 'ssh -o LogLevel=ERROR -i {} -4 -o StrictHostKeyChecking=no {}@{} \'/bin/bash -c "kill -9 {}"\''.format(user_keys.private_key_file, user, host, task.pid) out = os_shell(stop_command, capture=True) if out.exit_code != 0: if not 'No such process' in out.stderr: Loading @@ -286,7 +286,7 @@ class RemoteComputingManager(ComputingManager): user = task.computing.get_conf_param('user') # View log remotely view_log_command = 'ssh -i {} -4 -o StrictHostKeyChecking=no {}@{} \'/bin/bash -c "cat /tmp/{}_data/task.log"\''.format(user_keys.private_key_file, user, host, task.uuid) view_log_command = 'ssh -o LogLevel=ERROR -i {} -4 -o StrictHostKeyChecking=no {}@{} \'/bin/bash -c "cat /tmp/{}_data/task.log"\''.format(user_keys.private_key_file, user, host, task.uuid) out = os_shell(view_log_command, capture=True) if out.exit_code != 0: Loading Loading @@ -364,7 +364,7 @@ class SlurmComputingManager(ComputingManager): else: binds += ',{}'.format(task.extra_binds) run_command = 'ssh -i {} -4 -o StrictHostKeyChecking=no {}@{} '.format(user_keys.private_key_file, user, host) run_command = 'ssh -o LogLevel=ERROR -i {} -4 -o StrictHostKeyChecking=no {}@{} '.format(user_keys.private_key_file, user, host) run_command += '\'bash -c "echo \\"#!/bin/bash\nwget {}/api/v1/base/agent/?task_uuid={} -O \$HOME/agent_{}.py &> \$HOME/{}.log && export BASE_PORT=\\\\\\$(python \$HOME/agent_{}.py 2> \$HOME/{}.log) && '.format(webapp_conn_string, task.uuid, task.uuid, task.uuid, task.uuid, task.uuid) run_command += 'export SINGULARITY_NOHTTPS=true && export SINGULARITYENV_BASE_PORT=\\\\\\$BASE_PORT && {} '.format(authstring) run_command += 'rm -rf /tmp/{}_data && mkdir -p /tmp/{}_data/tmp &>> \$HOME/{}.log && mkdir -p /tmp/{}_data/home &>> \$HOME/{}.log && chmod 700 /tmp/{}_data && '.format(task.uuid, task.uuid, task.uuid, task.uuid, task.uuid, task.uuid) Loading Loading @@ -431,7 +431,7 @@ class SlurmComputingManager(ComputingManager): user = task.computing.get_conf_param('user') # Stop the task remotely stop_command = 'ssh -i {} -4 -o StrictHostKeyChecking=no {}@{} \'/bin/bash -c "scancel {}"\''.format(user_keys.private_key_file, user, host, task.pid) stop_command = 'ssh -o LogLevel=ERROR -i {} -4 -o StrictHostKeyChecking=no {}@{} \'/bin/bash -c "scancel {}"\''.format(user_keys.private_key_file, user, host, task.pid) out = os_shell(stop_command, capture=True) if out.exit_code != 0: raise Exception(out.stderr) Loading @@ -454,7 +454,7 @@ class SlurmComputingManager(ComputingManager): user = task.computing.get_conf_param('user') # View log remotely view_log_command = 'ssh -i {} -4 -o StrictHostKeyChecking=no {}@{} \'/bin/bash -c "cat \$HOME/{}.log"\''.format(user_keys.private_key_file, user, host, task.uuid) view_log_command = 'ssh -o LogLevel=ERROR -i {} -4 -o StrictHostKeyChecking=no {}@{} \'/bin/bash -c "cat \$HOME/{}.log"\''.format(user_keys.private_key_file, user, host, task.uuid) out = os_shell(view_log_command, capture=True) if out.exit_code != 0: Loading Loading @@ -518,7 +518,7 @@ class RemotehopComputingManager(ComputingManager): else: binds += ',{}'.format(task.extra_binds) run_command = 'ssh -i {} -4 -o StrictHostKeyChecking=no {}@{} '.format(user_keys.private_key_file, first_user, first_host) run_command = 'ssh -o LogLevel=ERROR -i {} -4 -o StrictHostKeyChecking=no {}@{} '.format(user_keys.private_key_file, first_user, first_host) run_command += '"ssh -4 -o StrictHostKeyChecking=no {}@{} /bin/bash -c \''.format(second_user, second_host) if use_agent: Loading Loading @@ -592,7 +592,7 @@ class RemotehopComputingManager(ComputingManager): second_user = task.computing.get_conf_param('second_user') # Stop the task remotely stop_command = 'ssh -i {} -4 -o StrictHostKeyChecking=no {}@{} '.format(user_keys.private_key_file, first_user, first_host) stop_command = 'ssh -o LogLevel=ERROR -i {} -4 -o StrictHostKeyChecking=no {}@{} '.format(user_keys.private_key_file, first_user, first_host) stop_command += '"ssh -4 -o StrictHostKeyChecking=no {}@{} '.format(second_user, second_host) stop_command += 'kill -9 {}"'.format(task.pid) Loading Loading @@ -621,7 +621,7 @@ class RemotehopComputingManager(ComputingManager): second_user = task.computing.get_conf_param('second_user') # View log remotely view_log_command = 'ssh -i {} -4 -o StrictHostKeyChecking=no {}@{} '.format(user_keys.private_key_file, first_user, first_host) view_log_command = 'ssh -o LogLevel=ERROR -i {} -4 -o StrictHostKeyChecking=no {}@{} '.format(user_keys.private_key_file, first_user, first_host) view_log_command += '"ssh -4 -o StrictHostKeyChecking=no {}@{} '.format(second_user, second_host) view_log_command += 'cat \\\\\\$HOME/{}.log"'.format(task.uuid) Loading
services/webapp/code/rosetta/core_app/decorators.py +13 −17 Original line number Diff line number Diff line Loading @@ -51,18 +51,16 @@ def public_view(wrapped_view): error_text = str(e) else: # Raise te exception if we are in debug mode # Log the exception logger.error(format_exception(e)) # Raise the exception if we are in debug mode if settings.DEBUG: raise # Otherwise, # Otherwise, mask it else: # first log the exception logger.error(format_exception(e)) # and then mask it. error_text = 'something went wrong' error_text = 'something went wrong ({})'.format(e) data = {'user': request.user, 'title': 'Error', Loading Loading @@ -111,18 +109,16 @@ def private_view(wrapped_view): error_text = str(e) else: # Raise te exception if we are in debug mode # Log the exception logger.error(format_exception(e)) # Raise the exception if we are in debug mode if settings.DEBUG: raise # Otherwise, # Otherwise, mask it else: # first log the exception logger.error(format_exception(e)) # and then mask it. error_text = 'something went wrong' error_text = 'something went wrong ({})'.format(e) data = {'user': request.user, 'title': 'Error', Loading