def _submit_job(cls, job_script_name, env=None): """ :param job_script_name: :return: the job manager job id """ # Create the qsub command for submitting the job job_script_filename = "./{}.sh".format(job_script_name) qsub_command = "qsub -N {} {} ".format(job_script_name, job_script_filename) output = run_command(qsub_command, env=env) # get the job id job_id = output.split()[2] return job_id
def execute_executable(cls, name, task, input_values, execution_data): """ Executes the Task as an executable for the given input values on the local machine :param task: the task to execute :type task: tigres.type.Task :param input_values: the input values for the task :type input_values: InputValues or list :Example: >>> from tigres.utils import Execution >>> from tigres.core.execution import load_plugin >>> engine = load_plugin(Execution.LOCAL_THREAD) >>> from tigres import InputTypes, InputValues, Task, EXECUTABLE >>> input_type_1 = InputTypes(None, [str]) >>> task1 = Task(None, EXECUTABLE, "/bin/echo", input_type_1) >>> input_values_1 = InputValues(None, ['world']) >>> engine.execute_executable("foo bar", task1, input_values_1,{'env':{}}) ('world', 'DONE') .. note:: The current implementation will coerce all arguments to strings when it builds the command for command line execution """ output = None if not execution_data or State.DONE not in list(execution_data.keys()): cmd = create_executable_command(input_values, task) # Get the current environment and pass it along to the executable copy_os_env = copy(os.environ) try: copy_os_env.update(execution_data['env']) output = run_command(cmd, env=copy_os_env) if execution_data is not None: execution_data[State.DONE] = State.DONE except Exception as err: raise TigresException( "Exception caught for execution '{w}', Task '{t}'. Error: {e}".format( w=name, t=task.name, e=err)) return output, State.DONE