def check_status(environ, status): if status['ID'] in environ.get('JobID_pos_atmos', ""): print(fc.yellow('Atmos post-processing: %s' % JOB_STATES[status['S']])) elif status['ID'] in environ.get('JobID_model', ""): if status['S'] == 'R': with hide('running', 'stdout'): fcts = run(fmt('find {workdir}/model/dataout/ -iname "*.fct.*" | sort', environ)) date = re.search('.*(\d{10})F.*', fcts.splitlines()[-1]) if date: current = datetime.strptime(date.groups()[0], "%Y%m%d%H") print_ETA(environ, status, current) else: print(fc.yellow('Preparing!')) else: print(fc.yellow('Model: %s' % JOB_STATES[status['S']]))
def check_status(environ, status): if status['ID'] in environ.get('JobID_pos_atmos', ""): print(fc.yellow('Atmos post-processing: %s' % JOB_STATES[status['S']])) elif status['ID'] in environ.get('JobID_model', ""): if status['S'] == 'R': with hide('running', 'stdout'): fcts = run( fmt( 'find {workdir}/model/dataout/ -iname "*.fct.*" | sort', environ)) date = re.search('.*(\d{10})F.*', fcts.splitlines()[-1]) if date: current = datetime.strptime(date.groups()[0], "%Y%m%d%H") print_ETA(environ, status, current) else: print(fc.yellow('Preparing!')) else: print(fc.yellow('Model: %s' % JOB_STATES[status['S']]))
def check_status(environ, status): if status['ID'] in environ.get('JobID_pos_ocean', ""): print(fc.yellow('Ocean post-processing: %s' % JOB_STATES[status['S']])) elif status['ID'] in environ.get('JobID_model', ""): fmsfile = fmt("{workdir}/fms.out", environ) if status['S'] == 'R': if not exists(fmsfile): print(fc.yellow('Preparing!')) else: with hide('running', 'stdout'): line = run('tac %s | grep -m1 yyyy' % fmsfile).splitlines()[-1] current = re.search('(\d{4})/(\s*\d{1,2})/(\s*\d{1,2})\s(\s*' '\d{1,2}):(\s*\d{1,2}):(\s*\d{1,2})', line) if current: current = datetime(*[int(i) for i in current.groups()]) print_ETA(environ, status, current) else: print(fc.yellow('Preparing!')) else: print(fc.yellow('Model: %s' % JOB_STATES[status['S']]))