def forecast_process_running(js): if 'pid' in js and 'process_create_time' in js: fs = js.process_create_time == process_create_time(js.pid) logging.info('Forecast process is running: %s pid=%s' % (fs, js.pid)) return fs else: logging.warning('Cannot determine if forecast process is running - old job file?') return None
def forecast_process_running(js): if 'pid' in js and 'process_create_time' in js: fs = js.process_create_time == process_create_time(js.pid) if fs: logging.info('Forecast process is running. pid=%s' % (js.pid)) else: logging.info('Forecast process is not running') return fs else: logging.warning( 'Cannot determine if forecast process is running - old job file?') return None
def make_job_file(js): """ Create minimal dictionary for the job state :param js: job state from JobState(args) :return: the dictionary """ jsub=Dict({}) jsub.job_id = js.job_id jsub.pid = os.getpid() jsub.process_create_time = process_create_time(jsub.pid) jsub.job_num = None jsub.old_job_num = None jsub.state = 'Preparing' jsub.qsys = js.qsys jsub.postproc = js.postproc jsub.grid_code = js.grid_code jsub.jobfile = osp.abspath(osp.join(js.workspace_path, js.job_id,'job.json')) return jsub
def make_job_file(js): """ Create minimal dictionary for the job state :param js: job state from JobState(args) :return: the dictionary """ jsub = Dict({}) jsub.job_id = js.job_id jsub.pid = os.getpid() jsub.process_create_time = process_create_time(jsub.pid) jsub.job_num = None jsub.old_job_num = None jsub.state = 'Preparing' jsub.qsys = js.qsys jsub.postproc = js.postproc jsub.grid_code = js.grid_code jsub.jobfile = osp.abspath( osp.join(js.workspace_path, js.job_id, 'job.json')) return jsub