13 import logging, os, sys
20 """!Uses an hwrf.input.InputSource to get data requested by the
21 HWRF configuration (hwrf_expt.inputiter()). Will exit with status
22 1 if any mandatory data is missing."""
27 cycle=hwrf_expt.conf.cycle
28 input_catalog=conf.get(
'config',
'input_catalog')
29 input_sources=conf.get(
'config',
'input_sources')
30 logger=conf.log(
'exhwrf_input')
31 WORKhwrf=conf.getdir(
'WORKhwrf')
33 if input_catalog!=
'hwrfdata':
34 jlogger.info(
"Input catalog is %s, not \"hwrfdata\" so data should "
35 "be staged on disk already. I have nothing to do, so "
36 "I'll just exit. This is not an error.")
44 htar=batchexe(conf.getexe(
'htar'))
47 hsi=batchexe(conf.getexe(
'hsi'))
57 logger.info(
'%s: skip dataset %s'%(arg,arg[5:]))
59 elif arg[0:5]==
'only:':
60 logger.info(
'%s: only pull dataset %s'%(arg,arg[5:]))
62 elif arg ==
'--stage':
63 logger.info(
'--stage: enable -Hnostage')
65 elif arg==
'-Hnostage' or arg==
'--nostage' or arg==
'--no-stage':
66 logger.info(
'%s: do not use -Hnostage'%(arg,))
69 logger.warning(
'Ignoring unrecognized argument %s'%(repr(arg),))
75 if ds
in skipme
or (onlyme
and (ds
not in onlyme)):
85 jlogger.info(
'Enabling htar -Hnostage option.')
86 htar=htar[
'-Hnostage']
88 jlogger.info(
'Not using htar -Hnostage option.')
92 htar=htar,hsi=hsi,logger=logger)
93 bad=
not getem.get(data,cat)
95 jlogger.error(
'Missing data in exhwrf_input. Workflow may fail.')
98 if __name__==
'__main__':
101 jlogger.info(
"HWRF input job starting")
103 jlogger.info(
"HWRF input job completed")
104 except Exception
as e:
105 jlogger.critical(
'HWRF input is aborting: '+str(e),exc_info=
True)
This module provides a set of utility functions to do filesystem operations.
Contains setup(), which initializes the produtil package.
def init_module
Initializes the HWRF object structure.
A shell-like syntax for running serial, MPI and OpenMP programs.
def setup(ignore_hup=False, dbnalert_logger=None, jobname=None, cluster=None, send_dbn=None, thread_logger=False, thread_stack=2 **24, kwargs)
Initializes the produtil package.
def inputiter()
Iterates over all inputs required by this configuration.
def chdir
Changes to the specified directory.