def queue_job(self, job_wrapper): command_line = '' job_destination = job_wrapper.job_destination try: job_wrapper.prepare() if hasattr(job_wrapper, 'prepare_input_files_cmds' ) and job_wrapper.prepare_input_files_cmds is not None: for cmd in job_wrapper.prepare_input_files_cmds: # run the commands to stage the input files #log.debug( 'executing: %s' % cmd ) if 0 != os.system(cmd): raise Exception( 'Error running file staging command: %s' % cmd) job_wrapper.prepare_input_files_cmds = None # prevent them from being used in-line command_line = self.build_command_line( job_wrapper, include_metadata=False, include_work_dir_outputs=False) except: job_wrapper.fail("failure preparing job", exception=True) log.exception("failure running job %d" % job_wrapper.job_id) return # If we were able to get a command line, run the job if not command_line: job_wrapper.finish('', '') return try: client = self.get_client_from_wrapper(job_wrapper) output_files = self.get_output_files(job_wrapper) input_files = job_wrapper.get_input_fnames() working_directory = job_wrapper.working_directory tool = job_wrapper.tool file_stager = FileStager(client, tool, command_line, job_wrapper.extra_filenames, input_files, output_files, working_directory) rebuilt_command_line = file_stager.get_rewritten_command_line() job_id = file_stager.job_id client.launch(rebuilt_command_line) job_wrapper.set_job_destination(job_destination, job_id) job_wrapper.change_state(model.Job.states.QUEUED) except: job_wrapper.fail("failure running job", exception=True) log.exception("failure running job %d" % job_wrapper.job_id) return lwr_job_state = AsynchronousJobState() lwr_job_state.job_wrapper = job_wrapper lwr_job_state.job_id = job_id lwr_job_state.old_state = True lwr_job_state.running = False lwr_job_state.job_destination = job_destination self.monitor_job(lwr_job_state)
def queue_job(self, job_wrapper): stderr = stdout = command_line = "" runner_url = job_wrapper.get_job_runner_url() try: job_wrapper.prepare() if hasattr(job_wrapper, "prepare_input_files_cmds") and job_wrapper.prepare_input_files_cmds is not None: for cmd in job_wrapper.prepare_input_files_cmds: # run the commands to stage the input files # log.debug( 'executing: %s' % cmd ) if 0 != os.system(cmd): raise Exception("Error running file staging command: %s" % cmd) job_wrapper.prepare_input_files_cmds = None # prevent them from being used in-line command_line = self.build_command_line(job_wrapper, include_metadata=False, include_work_dir_outputs=False) except: job_wrapper.fail("failure preparing job", exception=True) log.exception("failure running job %d" % job_wrapper.job_id) return # If we were able to get a command line, run the job if not command_line: job_wrapper.finish("", "") return try: # log.debug( 'executing: %s' % command_line ) client = self.get_client_from_wrapper(job_wrapper) output_files = self.get_output_files(job_wrapper) input_files = job_wrapper.get_input_fnames() working_directory = job_wrapper.working_directory file_stager = FileStager( client, command_line, job_wrapper.extra_filenames, input_files, output_files, job_wrapper.tool.tool_dir, working_directory, ) rebuilt_command_line = file_stager.get_rewritten_command_line() job_id = file_stager.job_id client.launch(rebuilt_command_line) job_wrapper.set_runner(runner_url, job_id) job_wrapper.change_state(model.Job.states.RUNNING) except Exception, exc: job_wrapper.fail("failure running job", exception=True) log.exception("failure running job %d" % job_wrapper.job_id) return
def queue_job(self, job_wrapper): command_line = '' job_destination = job_wrapper.job_destination try: job_wrapper.prepare() if hasattr(job_wrapper, 'prepare_input_files_cmds') and job_wrapper.prepare_input_files_cmds is not None: for cmd in job_wrapper.prepare_input_files_cmds: # run the commands to stage the input files #log.debug( 'executing: %s' % cmd ) if 0 != os.system(cmd): raise Exception('Error running file staging command: %s' % cmd) job_wrapper.prepare_input_files_cmds = None # prevent them from being used in-line command_line = self.build_command_line( job_wrapper, include_metadata=False, include_work_dir_outputs=False ) except: job_wrapper.fail( "failure preparing job", exception=True ) log.exception("failure running job %d" % job_wrapper.job_id) return # If we were able to get a command line, run the job if not command_line: job_wrapper.finish( '', '' ) return try: client = self.get_client_from_wrapper(job_wrapper) output_files = self.get_output_files(job_wrapper) input_files = job_wrapper.get_input_fnames() working_directory = job_wrapper.working_directory tool = job_wrapper.tool file_stager = FileStager(client, tool, command_line, job_wrapper.extra_filenames, input_files, output_files, working_directory) rebuilt_command_line = file_stager.get_rewritten_command_line() job_id = file_stager.job_id client.launch( rebuilt_command_line ) job_wrapper.set_job_destination( job_destination, job_id ) job_wrapper.change_state( model.Job.states.QUEUED ) except: job_wrapper.fail( "failure running job", exception=True ) log.exception("failure running job %d" % job_wrapper.job_id) return lwr_job_state = AsynchronousJobState() lwr_job_state.job_wrapper = job_wrapper lwr_job_state.job_id = job_id lwr_job_state.old_state = True lwr_job_state.running = False lwr_job_state.job_destination = job_destination self.monitor_job(lwr_job_state)
def queue_job(self, job_wrapper): stderr = stdout = command_line = '' runner_url = job_wrapper.get_job_runner_url() try: job_wrapper.prepare() if hasattr(job_wrapper, 'prepare_input_files_cmds') and job_wrapper.prepare_input_files_cmds is not None: for cmd in job_wrapper.prepare_input_files_cmds: # run the commands to stage the input files #log.debug( 'executing: %s' % cmd ) if 0 != os.system(cmd): raise Exception('Error running file staging command: %s' % cmd) job_wrapper.prepare_input_files_cmds = None # prevent them from being used in-line command_line = self.build_command_line( job_wrapper, include_metadata=False, include_work_dir_outputs=False ) except: job_wrapper.fail( "failure preparing job", exception=True ) log.exception("failure running job %d" % job_wrapper.job_id) return # If we were able to get a command line, run the job if not command_line: job_wrapper.finish( '', '' ) return try: #log.debug( 'executing: %s' % command_line ) client = self.get_client_from_wrapper(job_wrapper) output_files = self.get_output_files(job_wrapper) input_files = job_wrapper.get_input_fnames() working_directory = job_wrapper.working_directory file_stager = FileStager(client, command_line, job_wrapper.extra_filenames, input_files, output_files, job_wrapper.tool.tool_dir, working_directory) rebuilt_command_line = file_stager.get_rewritten_command_line() job_id = file_stager.job_id client.launch( rebuilt_command_line ) job_wrapper.set_runner( runner_url, job_id ) job_wrapper.change_state( model.Job.states.RUNNING ) except Exception, exc: job_wrapper.fail( "failure running job", exception=True ) log.exception("failure running job %d" % job_wrapper.job_id) return