def submit_job(job_file, temp_dir, dbname, user_name, callback_url=None, foreign_calc_id=None, hazard_output_id=None, hazard_job_id=None, logfile=None): """ Create a job object from the given job.ini file in the job directory and submit it to the job queue. """ ini = os.path.join(temp_dir, job_file) job, exctype = safely_call(oq_engine.job_from_file, (ini, user_name, DEFAULT_LOG_LEVEL, '', hazard_output_id, hazard_job_id)) if exctype: tasks.update_calculation(callback_url, status="failed", einfo=job) raise exctype(job) future = executor.submit(tasks.safely_call, tasks.run_calc, job.id, temp_dir, callback_url, foreign_calc_id, dbname, logfile) return job, future
def submit_job(job_file, temp_dir, dbname, callback_url=None, foreign_calc_id=None, hazard_output_id=None, hazard_calculation_id=None, logfile=None): """ Create a job object from the given job.ini file in the job directory and submit it to the job queue. """ try: job = oq_engine.job_from_file( job_file, "platform", DEFAULT_LOG_LEVEL, [], hazard_output_id, hazard_calculation_id) except: # catch errors in the job creation phase etype, exc, tb = sys.exc_info() einfo = "".join(traceback.format_tb(tb)) einfo += '%s: %s' % (etype.__name__, exc) tasks.update_calculation(callback_url, status="failed", einfo=einfo) raise calc = job.calculation job_type = 'risk' if job.calculation is job.risk_calculation else 'hazard' future = executor.submit( tasks.run_calc, job_type, calc.id, temp_dir, callback_url, foreign_calc_id, dbname, logfile) return job, future
def submit_job(job_ini, user_name, hazard_job_id=None, loglevel=DEFAULT_LOG_LEVEL, logfile=None, exports=''): """ Create a job object from the given job.ini file in the job directory and submit it to the job queue. Returns the job ID. """ job_id, oqparam = engine.job_from_file(job_ini, user_name, hazard_job_id) fut = executor.submit(engine.run_calc, job_id, oqparam, loglevel, logfile, exports, hazard_job_id) return job_id, fut
def submit_job(job_file, temp_dir, user_name, hazard_job_id=None, logfile=None): """ Create a job object from the given job.ini file in the job directory and submit it to the job queue. """ ini = os.path.join(temp_dir, job_file) err, exctype, monitor = safely_call( db.actions.job_from_file, (ini, user_name, hazard_job_id)) if exctype: raise exctype(err) job_id, oqparam = err future = executor.submit( tasks.safely_call, tasks.run_calc, job_id, oqparam, temp_dir, logfile, hazard_job_id) return job_id, future
def submit_job(job_file, temp_dir, dbname, callback_url=None, foreign_calc_id=None, hazard_output_id=None, hazard_job_id=None, logfile=None): """ Create a job object from the given job.ini file in the job directory and submit it to the job queue. """ job, exctype = safely_call( oq_engine.job_from_file, (job_file, "platform", DEFAULT_LOG_LEVEL, [], hazard_output_id, hazard_job_id)) if exctype: tasks.update_calculation(callback_url, status="failed", einfo=job) raise exctype(job) future = executor.submit( tasks.safely_call, tasks.run_calc, job.job_type, job.id, temp_dir, callback_url, foreign_calc_id, dbname, logfile) return job, future