2 import os, sys, stat, pwd, glob
7 KNOWN_OS_CONTAINERS = {
8 "sl6":
"/cvmfs/singularity.opensciencegrid.org/fermilab/fnal-wn-sl6:latest",
9 "sl7":
"/cvmfs/singularity.opensciencegrid.org/fermilab/fnal-wn-sl7:latest",
10 "el8":
"/cvmfs/singularity.opensciencegrid.org/fermilab/fnal-wn-el8:latest",
15 sys.stderr.write(
"\033[91mERROR in %s\033[0m " %prog)
17 sys.stderr.write(
"\n")
21 sys.stderr.write(
"\033[93mWARNING in %s\033[0m " %prog)
23 sys.stderr.write(
"\n")
26 sys.stderr.write(
"\033[94mINFO in %s\033[0m " %prog)
28 sys.stderr.write(
"\n")
32 retval = os.system(
"cigetcert -ns fifebatch.fnal.gov")
34 fail(
"Failed to get a certificate. Check kerberos credentials or run cigetcert -s fifebatch.fnal.gov")
38 fname = os.path.expandvars(fname)
39 if not os.path.isfile(fname):
40 fail(
"Invalid file %s" %fname)
43 dname = os.path.expandvars(dname)
44 if not os.path.isdir(dname):
45 fail(
"Invalid directory %s" %dname)
48 dname = os.path.expandvars(dname)
49 if not os.path.isdir(dname):
50 print (
"Making directory",dname)
54 novasoft_development =
"/cvmfs/nova-development.opensciencegrid.org/novasoft/" 55 if tag ==
"development":
56 tag = os.path.split(os.readlink(novasoft_development +
"releases/development"))[1]
57 print (
"Note: using current nightly release '%s' as development..." % tag)
59 srt_dist = os.getenv(
"SRT_DIST",
"undefined")
60 if srt_dist !=
"undefined":
62 srt_dist = novasoft_development
64 tag_dir = srt_dist +
"/releases/" + tag
65 if not os.path.isdir(tag_dir):
66 tag_dir =
"/cvmfs/nova.opensciencegrid.org/novasoft/slf?/novasoft/releases/" + tag
67 if not glob.glob(tag_dir):
68 fail(
"Specified tag %s doesn't exist" % tag)
70 novasoftloc = os.getenv(
"NOVASOFT_FQ_DIR",
"undefined")
71 if(novasoftloc ==
"undefined"):
72 fail(
"novasoft location is unspecified, was the ups product setup?")
76 stat_info = os.stat(fname)
77 file_stat_mode = stat_info.st_mode
78 return file_stat_mode & stat.S_IWGRP
83 fail(
"%s is not group writable, but should be" % fname)
89 fail(
"%s is neither group writable nor owned by novapro, but should be" % fname)
92 stat_info = os.stat(fname)
93 file_stat_uid = stat_info.st_uid
94 return pwd.getpwuid(file_stat_uid)[0]
97 hostname=socket.getfqdn()
98 if hostname.endswith(
"smu.edu"):
99 return "/scratch/data/srm/nova/production/DropBox/" 101 return "/pnfs/nova/scratch/fts/dropbox" 113 if dest.startswith(
"s3://")
and not args.amazon:
114 fail(
"Not using amazon, but output destination is on s3!")
115 elif not dest.startswith(
"s3://")
and args.amazon:
116 fail(
"Using amazon, but output destination is not on s3!")
117 elif dest !=
"/pnfs/nova/scratch/fts/dropbox" and not args.test_submission:
119 warn(
"Destination directory is "+dest+
", not \"/pnfs/nova/scratch/fts/dropbox\", but you are submitting production jobs. Is that what you meant? Pausing for 5s")
122 if not dest.startswith(
"s3://"):
125 args.jsonMetadata =
True 127 if (
None == args.outTier)
and (
None == args.cafTier)
and (
None == args.h5Tier):
128 fail(
"Running in production mode, but no tiers (art or caf) specified")
153 'Comma separated list of grid node requirements.' 154 ' Example: ssse3,sse4_1' 156 dest =
'node_features',
158 type =
lambda s : [ x
for x
in s.split(
',')
if x ],
163 if len(features) == 0:
166 result =
"&&".join([
"(TARGET.has_%s==true)" % (x)
for x
in features ])
167 result =
"--append_condor_requirements='(%s)'" % (result)
def setup_production(args)
def check_is_group_writable(fname)
def make_jobsub_node_features_arg(features)
def get_file_owner(fname)
def add_node_features_arg(parser)
def get_credentials(role)
def check_is_production_writable(fname)
def setup_calibration(args)
def check_make_dir(dname)
def is_group_writable(fname)