From 245e2f938a7501d95dde47e1c47a1dd66fbfd0aa Mon Sep 17 00:00:00 2001 From: "Ricardo M. Ferraz Leal" Date: Thu, 8 Dec 2016 15:21:51 -0500 Subject: [PATCH] Typos --- README.rst | 16 +++++++++++----- django_remote_submission/tasks.py | 8 +++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/README.rst b/README.rst index f98e816..2f5a584 100644 --- a/README.rst +++ b/README.rst @@ -33,12 +33,18 @@ Then use it in a project:: port=22, )[0] - interpreter = Interpreter.objects.get_or_create( - name = 'python', - path = '/usr/bin/python -u', + python2_interpreter = Interpreter.objects.get_or_create( + name = 'python2', + path = '/usr/bin/python2.7 -u', )[0] - server.interpreters.set([interpreter]) + python3_interpreter = Interpreter.objects.get_or_create( + name = 'python3', + path = '/usr/bin/python3.5 -u', + )[0] + + server.interpreters.set([python2_interpreter, + python3_interpreter]) job = Job.objects.get_or_create( title='My Job Title', @@ -47,7 +53,7 @@ Then use it in a project:: remote_filename='test.py', owner=request.user, server=server, - interpreter=interpreter, + interpreter=python2_interpreter, )[0] modified_files = submit_job_to_server( diff --git a/django_remote_submission/tasks.py b/django_remote_submission/tasks.py index 1ea8306..98765d5 100644 --- a/django_remote_submission/tasks.py +++ b/django_remote_submission/tasks.py @@ -94,18 +94,16 @@ def submit_job_to_server(job_pk, password, username=None, client=None, command = '{} {}'.format(job.interpreter.path,job.remote_filename) if timeout is not None: command = 'timeout {}s {}'.format(timeout.total_seconds(), command) - return command - - logger.debug("Executing remotely the command: %s.", command) stdin, stdout, stderr = client.exec_command( - command='cd {} && {}'.format( + command='mkdir -p {0} && cd {0} && {1}'.format( job.remote_directory, command, ), bufsize=1, ) - + logger.debug("Executed remotely the command: %s.", command) + channel = stdin.channel # In parallel creates logs for both stdout and stderr