ó ‹÷Îgc@sšdZddddgZddlZddd„ƒYZeƒZdZdadada da d „Z d „Z d „Z d „Zdd „Zed„Zed„Zeed„ZdS(să!Provides information about the batch system. This module is intended to be used to communicate with the batch system. At present, it just knows how to guess the job name and id, as well as a "longname" that combines the two.tjobnametjobidt joblongnametNONAMEi˙˙˙˙Nt FakeClasscBseZdZRS(s!A special class for constants.(t__name__t __module__t__doc__(((sA/lfs/h1/ops/prod/packages/hafs.v2.0.7/ush/produtil/batchsystem.pyRscCs |adS(sE!Set default for all job names. Sets a default value to use for the job name and long name if it cannot be guessed from the environment. This is used by produtil.setup.setup's jobname= argument. This will override the fallback= arguments of both jobname() and joblongname() @param default_name the nameN(t _set_default(t default_name((sA/lfs/h1/ops/prod/packages/hafs.v2.0.7/ush/produtil/batchsystem.pytset_default_name)s cCst|ƒadS(sI!Sets the value that jobname() should return. @param jobname the nameN(tstrt _set_jobname(R((sA/lfs/h1/ops/prod/packages/hafs.v2.0.7/ush/produtil/batchsystem.pyt set_jobname4scCst|ƒadS(sC!Sets the value that jobid() should return. @param jobid the idN(R t _set_jobid(R((sA/lfs/h1/ops/prod/packages/hafs.v2.0.7/ush/produtil/batchsystem.pyt set_jobid:scCst|ƒadS(sZ!Sets the value that joblongname() should return. @param joblongname the new long nameN(R t_set_joblongname(R((sA/lfs/h1/ops/prod/packages/hafs.v2.0.7/ush/produtil/batchsystem.pytset_joblongname@scCsex^|D]V}|tjkr"qntj|}t|tƒsDqnt|ƒdkr\qn|SW|S(sE!Get an environment variable, with various fallback options Tries the list of environment variable names, returning the first one that exists and is non-blank. If none are found, returns the fallback. @param names the list of environment variables @param fallback the fallback option if none are set i(tostenviront isinstanceR tlen(tnamestfallbacktnametval((sA/lfs/h1/ops/prod/packages/hafs.v2.0.7/ush/produtil/batchsystem.pytgetenvsFs  cCs\tr tStddddddgƒ}|dk r8|Stdk rHtS|tk rX|StS(sé!Get the batch job name Returns the human-readable job name, if one exists. If set_jobname was called, returns its value. Otherwise, attempts to get it from the NCO $job environment variable first, then tries the batch system variables. If none are found, and fallback is specified, then the fallback is returned. Otherwise, the module-level NONAME variable is returned (which defaults to "NONAME"). @param fallback return value if no job name is knowntjobt LSB_JOBNAMEt PBS_JOBNAMEt MOAB_JOBNAMEtLOADL_STEP_NAMEtLOADL_JOB_NAMEN(R RtNoneRt UNSPECIFIEDR(Rtret((sA/lfs/h1/ops/prod/packages/hafs.v2.0.7/ush/produtil/batchsystem.pyRVs    cCsbtdddddgƒ}|dk r+|Stdk r;tS|tk rK|SdttjƒƒfS(sĆ!Get the batch job ID Returns the batch system job id for the batch job that is running this program, if known. If set_jobid was called, returns its value. Otherwise, tries the NCO $pid first, then the various batch system environment variables. If none are found, and the fallback is specified, returns the fallback. Otherwise, returns "o$PID" where $PID is the process ID. @param fallback the fallback if no id is knowntpidt LSB_JOBIDt PBS_JOBIDt MOAB_JOBIDt LOADL_STEP_IDso%sN(RR!RR"R Rtgetpid(RR#((sA/lfs/h1/ops/prod/packages/hafs.v2.0.7/ush/produtil/batchsystem.pyRis    cCsCtr tStdgƒ}|dk r)|Sdt|ƒt|ƒfS(sD!Get the job longname Returns a human-readable job name that includes both the batch system job name and id. If set_joblongname was called, returns its value. Next, returns the NCO $jobid variable if available, otherwise returns LL{jobid()}.o{jobname()} where jobid and jobname are the results of those two functions. The jobid_fallback and jobname_fallback are passed as the fallback parameters to the calls to jobid and jobname. @param jobid_fallback the fallback if no id is known @param jobname_fallback the fallback if no name is knownRsLL%s.%sN(RRR!RR(tjobid_fallbacktjobname_fallbackR#((sA/lfs/h1/ops/prod/packages/hafs.v2.0.7/ush/produtil/batchsystem.pyRys  ((Rt__all__RRR"RR!R RRRR R RRRRRR(((sA/lfs/h1/ops/prod/packages/hafs.v2.0.7/ush/produtil/batchsystem.pyts$