Commit 9d9538d9 authored by André Anjos's avatar André Anjos 💬

Revert "[prefix_cmd] Add support for a prefix command for user-code executables"

This reverts commit e235fb01.
parent e235fb01
Pipeline #1954 passed with stage
......@@ -391,8 +391,8 @@ class Agent(object):
logger.debug("Exiting processing context...")
def run(self, configuration, timeout_in_minutes=0, daemon=0, prefix_cmd=None):
"""Runs the user algorithm code, possibly as another system user or group
def run(self, configuration, timeout_in_minutes=0, daemon=0):
"""Runs the algorithm code
Parameters:
......@@ -400,18 +400,15 @@ class Agent(object):
configuration (object): A *valid*, preloaded
:py:class:`beat.core.execution.Executor` object.
timeout_in_minutes (int, Optional): The number of minutes to wait for the
user process to execute. After this amount of time, the user process is
timeout_in_minutes (int): The number of minutes to wait for the user
process to execute. After this amount of time, the user process is
killed with :py:attr:`signal.SIGKILL`. If set to zero, no timeout will
be applied.
daemon (int, Optional): If this variable is set, then we don't really
start the user process, but just kick out 0MQ server, print the
command-line and sleep for that many seconds. You're supposed to start
the client by hand then and debug it.
prefix_cmd (list, Optional): A prefix to the command to execute allowing
you to encapsulate the user executable
daemon (int): If this variable is set, then we don't really start the
user process, but just kick out 0MQ server, print the command-line and
sleep for that many seconds. You're supposed to start the client by
hand then and debug it.
"""
......@@ -431,14 +428,11 @@ class Agent(object):
cmd = ['sleep', str(daemon)]
logger.debug("Daemon mode: sleeping for %d seconds", daemon)
if prefix_cmd is not None:
cmd = prefix_cmd + cmd
self.process = async.Popen(
cmd=cmd,
virtual_memory_in_megabytes=self.virtual_memory_in_megabytes,
max_cpu_percent=self.max_cpu_percent,
cpulimit_path=self.cpulimit_path,
cpulimit_path=self.cpulimit_path
)
# provide a tip on how to stop the test
......
......@@ -233,7 +233,7 @@ class Popen(gevent.subprocess.Popen):
virtual_memory_in_megabytes = max(virtual_memory_in_megabytes, 0)
cmd = _sandbox_memory(cmd, virtual_memory_in_megabytes)
logger.debug("Running command `%s'", ' '.join(cmd))
logger.debug("Running command `%s'" % ' '.join(cmd))
super(Popen, self).__init__(
cmd,
......
......@@ -539,7 +539,7 @@ class Executor(object):
def process(self, execute_path=None, virtual_memory_in_megabytes=0,
max_cpu_percent=0, cpulimit_path=None, timeout_in_minutes=0,
daemon=0, prefix_cmd=None):
daemon=0):
"""Executes the user algorithm code using an external program.
If ``executable`` is set, then execute the process using an external
......@@ -596,9 +596,6 @@ class Executor(object):
sleep for that many seconds. You're supposed to start the client by
hand then and debug it.
prefix_cmd (list, Optional): A prefix to the command to execute allowing
you to encapsulate the user executable
Returns:
......@@ -626,7 +623,7 @@ class Executor(object):
#synchronous call - always returns after a certain timeout
retval = runner.run(self, timeout_in_minutes=timeout_in_minutes,
daemon=daemon, prefix_cmd=prefix_cmd)
daemon=daemon)
#adds I/O statistics from the current executor, if its complete already
#otherwise, it means the running process went bananas, ignore it ;-)
......
......@@ -87,7 +87,7 @@ def load_result(executor):
return data
def execute(label, expected_result, prefix_cmd=None):
def execute(label, expected_result):
"""Executes the full experiment, block after block, returning results. If an
error occurs, returns information about the err'd block. Otherwise, returns
``None``.
......@@ -115,7 +115,7 @@ def execute(label, expected_result, prefix_cmd=None):
assert executor.valid, '\n * %s' % '\n * '.join(executor.errors)
with executor:
result = executor.process(prefix_cmd=prefix_cmd)
result = executor.process()
assert result
assert 'status' in result
assert 'stdout' in result
......@@ -171,8 +171,8 @@ def test_single_1_single():
@slow
@nose.tools.with_setup(teardown=cleanup)
def test_single_1_add_prefix_cmd():
assert execute('user/user/single/1/single_add', [{'out_data': 43}], ['/usr/bin/time']) is None
def test_single_1_add():
assert execute('user/user/single/1/single_add', [{'out_data': 43}]) is None
@slow
@nose.tools.with_setup(teardown=cleanup)
......
Markdown is supported
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