32     """!Main program for disk archiving.   
   34     Creates an on-disk archiving for one of two cases: 
   35     * disk:/path/to/archive.tar.gz --- generates an on-disk *.tar.gz 
   36       archive in a long-term storage disk area 
   37     * hpsz:/path/to/tape-archive.tar.gz --- generates an on-disk 
   38       *.tar.gz archive in a temporary location so it can be copied to 
   39       tape in a later step.""" 
   40     postmsg(
'hwrf_archive disk step starting')
 
   42     logger=conf.log(
'archive.disk')
 
   43     if conf.has_section(
'archive'):
 
   44         makethedir=conf.getbool(
'archive',
'mkdir',
False)
 
   47     archive=conf.getloc(
'archive',
'NONE')
 
   49         logger.info(
'No archive location specified.  Exiting.')
 
   50         postmsg(
'hwrf_archive disk step has nothing to do when archiving is ' 
   54         flist=[ filename+
'\n' for filename 
in glob.glob(
'*') ]
 
   58         if archive.lower()==
'none':
 
   59             postmsg(
'Archiving is disabled: archive=none')
 
   61         elif archive[0:5]==
'disk:':
 
   64                 adir=os.path.dirname(path)
 
   65                 if not os.path.exists(adir):
 
   68             if path[-3:]==
'.gz' or path[-4:]==
'.tgz':
 
   70             cmd=exe(conf.getexe(
'tar'))[flags+
'f',path,
'-T',
'-'] << files
 
   71         elif archive[0:5]==
'hpss:':
 
   72             logger.info(
'HPSS archiving enabled.')
 
   73             logger.info(
'Nothing to do in the disk archiving step.')
 
   74             logger.info(
'Returning successfully after doing nothing.')
 
   75             postmsg(
'hwrf_archive disk step does nothing when using htar ' 
   78         elif archive[0:5]==
'hpsz:':
 
   79             path=conf.strinterp(
'config',
'{WORKhwrf}/stage-archive.tar.gz')
 
   80             cmd=exe(conf.getexe(
'tar'))[
'-cvpf',path,
'-T',
'-'] << files
 
   82             jlogger.error(
'Ignoring invalid archive method %s in %s' 
   83                           %(archive[0:4],archive))
 
   85         checkrun(cmd,logger=logger)
 
   86     postmsg(
'hwrf_archive disk step completed')
 
   89     """!Main program for tape archiving.   
   91     Does one of two things: 
   93     * hpss:/path/to/archive.tar --- will use the htar command to 
   94       archive COM directory outputs 
   95     * hpsz:/path/to/archive.tar.gz --- will copy a tar.gz file from a 
   96       temporary area, made by the disk archiving step, to a tape 
   97       destination using the "hsi put" command.""" 
   98     postmsg(
'hwrf_archive tape step starting')
 
  100     logger=conf.log(
'archive.disk')
 
  101     archive=conf.getloc(
'archive',
'NONE')
 
  102     if conf.has_section(
'archive'):
 
  103         makethedir=conf.getbool(
'archive',
'mkdir',
False)
 
  107         logger.info(
'No archive location specified.  Exiting.')
 
  108         postmsg(
'hwrf_archive disk step has nothing to do when archiving is ' 
  112         flist=[ filename+
'\n' for filename 
in glob.glob(
'*') ]
 
  117         if archive.lower()==
'none':
 
  118             postmsg(
'Archiving is disabled: archive=none')
 
  120         elif archive[0:5]==
'disk:':
 
  121             logger.info(
'Disk archiving enabled.')
 
  122             logger.info(
'Nothing to do in the HPSS archiving step.')
 
  123             logger.info(
'Returning successfully after doing nothing.')
 
  124             postmsg(
'hwrf_archive tape step does nothing when using disk ' 
  127         elif archive[0:5]!=
'hpss:' and archive[0:5]!=
'hpsz:':
 
  128             jlogger.error(
'Ignoring invalid archive method %s in %s' 
  129                           %(archive[0:4],archive))
 
  133             adir=os.path.dirname(archive[5:])
 
  134             logger.info(
'%s: make this HPSS directory, even if it exists'%(adir,))
 
  135             mcmd=exe(conf.getexe(
'hsi'))[
'-P',
'mkdir',
'-p',adir]
 
  136             run(mcmd,logger=logger)
 
  138         if archive[0:5]==
'hpss:':
 
  141             cmd=exe(conf.getexe(
'htar'))[flags+
'f',path,
'-L',
'-'] << files
 
  142         elif archive[0:5]==
'hpsz:':
 
  145             frompath=conf.strinterp(
'config',
 
  146                                     '{WORKhwrf}/stage-archive.tar.gz')
 
  147             cmd=exe(conf.getexe(
'hsi'))[
'put',frompath,
':',topath]
 
  148         checkrun(cmd,logger=logger)
 
  149     postmsg(
'hwrf_archive tape step completed')
 
  151 if __name__==
'__main__':
 
  153         acase=os.environ.get(
'ARCHIVE_STEP',
'BOTH').upper()
 
  158         elif acase == 
'TAPE':
 
  160         elif acase == 
'BOTH':
 
  164             postmsg(
'INVALID JHWRF_ARCHIVE STEP %s!! ABORTING!' 
  166     except Exception 
as e:
 
  167         jlogger.critical(
'hwrf_archive is aborting: '+str(e),exc_info=
True)
 
Change directory, handle temporary directories. 
 
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. 
 
This subclass of TempDir takes a directory name, instead of generating one automatically. 
 
def makedirs
Make a directory tree, working around filesystem bugs. 
 
def main_tape()
Main program for tape archiving. 
 
def main_disk()
Main program for disk archiving.