1 """!Provides information about the cluster on which this job is running"""
5 __all__=[
'Cluster',
'where',
'longname',
'name',
'group_quotas',
'acl_support',
6 'no_access_control',
'use_acl_for_rstdata',
'ncepprod',
7 'NOAAJet',
'NOAAGAEA',
'NOAAZeus',
'NOAAWCOSS']
9 import time, socket, os
16 """!Stores information about a computer cluster. """
17 def __init__(self,group_quotas,acl_support,production,name,longname,
18 use_acl_for_rstdata=
None):
19 """!Sets all public member variables. All are mandatory except
20 use_acl_for_rstdata. The default for use_acl_for_Rstdata is
21 the logical AND of group_quotas and acl_support."""
24 if production
is not DO_NOT_SET:
28 if use_acl_for_rstdata
is None:
64 """!Sets the current cluster (module-level "here" variable) to the
65 given value. Bad things may happen if this is not a subclass of
67 #@param there A Cluster object for this local cluster."""
72 """!Guesses what cluster the program is running on, and if it
73 cannot, returns a cluster named "noname" with reasonable defaults.
74 The result is stored in the module scope "here" variable."""
77 if os.path.exists(
'/pan2'):
79 elif os.path.exists(
'/glade'):
81 elif os.path.exists(
'/data')
and os.path.exists(
'/scratch')
and \
82 os.path.exists(
'/home'):
84 elif os.path.exists(
'/scratch3'):
86 with open(
'/proc/cpuinfo',
'rt')
as f:
87 for line
in f.readlines(1000):
88 if line.find(
'E5-2690')>=0:
95 elif os.path.exists(
'/ptmpd2'):
97 elif os.path.exists(
'/gpfs/hps/nco'):
100 here=
Cluster(
False,
False,
False,
'noname',
'noname')
104 """!Synonym for here.longname. Will call the "where()" function if
105 "here" is uninitialized."""
106 if here
is None:
where()
110 """!Synonym for here.name. Will call the "where()" function if
111 "here" is uninitialized."""
112 if here
is None:
where()
116 """!Synonym for here.group_quotas. Will call the "where()" function if
117 "here" is uninitialized."""
118 if here
is None:
where()
119 return here.group_quotas
122 """!Synonym for here.acl_support. Will call the "where()" function if
123 "here" is uninitialized."""
124 if here
is None:
where()
125 return here.acl_support
128 """!True if the cluster provides no means to control access to
129 files. This is true if the cluster uses group ids for quotas, and
130 provides no access control list support."""
131 if here
is None:
where()
132 return here.group_quotas
and not here.use_acl_for_rstdata
135 """!Synonym for here.use_acl_for_rstdata. Will call the "where()"
136 function if "here" is uninitialized."""
137 if here
is None:
where()
138 return here.use_acl_for_rstdata
141 """!Are we on NCEP production?
143 @returns True if the present machine is the NCEP production
144 machine. Note that this function may read a text file when it is
145 called, and the return value may change during the execution of
146 the program if the program is running during a production switch."""
147 if here
is None:
where()
148 return here.production
and ( here.name==
'tide' or here.name==
'gyre' )
151 """!The NOAA Jet Cluster
153 Represents the NOAA Jet cluster, which has non-functional ACL
154 support. Will report that ACLs are supported, but should not be
155 used. Also, group quotas are in use. That means that there is no
156 means by which to restrict access control, so no_access_control()
159 """!constructor for NOAAJet"""
160 super(NOAAJet,self).
__init__(
True,
True,
False,
'jet',
161 'jet.rdhpcs.noaa.gov',
False)
164 """!Represents the NOAA GAEA cluster. Allows ACLs to be used for
165 restricted data, and specifies that group quotas are in use."""
167 """!constructor for NOAAGAEA"""
168 super(NOAAGAEA,self).
__init__(
True,
True,
False,
'gaea',
169 'gaea.rdhpcs.noaa.gov')
172 """!Represents the NOAA Zeus cluster. Allows ACLs to be used for
173 restricted data, and specifies that group quotas are in use."""
175 """!Constructor for NOAAZeus"""
176 super(NOAAZeus,self).
__init__(
True,
True,
False,
'zeus',
177 'zeus.rdhpcs.noaa.gov')
180 """!Represents the Yellowstone cluster. Does not allow ACLs,
181 assumes group quotas."""
183 """!Constructor for UCARYellowstone"""
184 super(UCARYellowstone,self).
__init__(
185 True,
False,
False,
'yellowstone',
'yellowstone.ucar.edu')
188 """!Represents the S4 cluster. Does not allow ACLs, assumes group
191 """!Constructor for WisconsinS4"""
193 True,
False,
False,
's4',
's4.ssec.wisc.edu')
196 """Represents the NOAA Theia cluster. Does not allow ACLs,
197 assumes no group quotas (fileset quotas instead)."""
199 super(NOAATheia,self).__init__(
200 False,
False,
False,
'theia',
'theia.rdhpcs.noaa.gov')
203 """!Represents the NOAA WCOSS clusters, Tide, Gyre and the test
206 Automatically determines which WCOSS the program is on based on
207 the first letter of socket.gethostname(). Will report no ACL
208 support, and no group quotas. Hence, the cluster should use group
209 IDs for access control.
211 The production accessor is no longer a public member variable: it
212 is now a property, which may open the /etc/prod file. The result
213 of the self.production property is cached for up to
214 prod_cache_time seconds. That time can be specified in the
215 constructor, and defaults to 30 seconds."""
217 """!Creates a NOAAWCOSS object, and optionally specifies the
218 time for which the result of self.production should be cached.
220 @param prod_cache_time how long to cache the prod vs. dev information, in seconds"""
222 host1=socket.gethostname()[0:1]
223 if host1==
't': name=
'tide'
224 elif host1==
'g': name=
'gyre'
226 super(NOAAWCOSS,self).
__init__(
False,
False,DO_NOT_SET,name,
227 name+
'.ncep.noaa.gov')
232 """!Clears the cached value of self.production so the next call
233 will return up-to-date information."""
238 """!Is this the WCOSS production machine?
240 The return value may change during the execution of this
241 program if a production switch happened. In addition, the
242 check requires opening and parsing the /etc/prod file, so the
243 runtime is likely several milliseconds when the cache times
244 out. To force a refresh of this information, call
245 self.uncache() first."""
248 tide = self.
name==
'tide'
249 gyre = self.
name==
'gyre'
251 with open(
'/etc/prod',
'/rt')
as f:
253 if line.find(
'tide')>=0: prod=tide
254 if line.find(
'gyre')>=0: prod=gyre
262 """!This subclass of NOAAWCOSS handles the new Cray portions of WCOSS.
263 Presently, it always reports the name "luna" and says it is not production."""
265 """!Create a new WCOSSCray object describing this cluster as a Cray machine.
266 @property name The name of the cluster. Default: "luna" """
267 if name
is None: name=
'luna'
268 super(WCOSSCray,self).
__init__(name=name)
271 """!Is this the WCOSS production machine? No. Returns False."""
274 """!Does nothing. This is here to disable NOAAWCOSS.uncache()"""
def __init__
Creates a NOAAWCOSS object, and optionally specifies the time for which the result of self...
def no_access_control()
True if the cluster provides no means to control access to files.
Represents the NOAA WCOSS clusters, Tide, Gyre and the test system Eddy.
def where()
Guesses what cluster the program is running on, and if it cannot, returns a cluster named "noname" wi...
def ncepprod()
Are we on NCEP production?
def uncache(self)
Does nothing.
def __init__(self)
Constructor for WisconsinS4.
Represents the S4 cluster.
def uncache(self)
Clears the cached value of self.production so the next call will return up-to-date information...
def __init__(self)
constructor for NOAAJet
def use_acl_for_rstdata()
Synonym for here.use_acl_for_rstdata.
group_quotas
True if group membership is used to manage disk quotas.
def production(self)
Is this the WCOSS production machine?
def __init__(self)
Constructor for UCARYellowstone.
def __init__
Sets all public member variables.
def __init__(self)
Constructor for NOAAZeus.
acl_support
True if the system uses Access Control Lists (ACLs) to control access to files.
Stores information about a computer cluster.
def set_cluster(there)
Sets the current cluster (module-level "here" variable) to the given value.
def acl_support()
Synonym for here.acl_support.
use_acl_for_rstdata
True if the scripts should use ACLs to protect restricted access data.
def group_quotas()
Synonym for here.group_quotas.
Represents the NOAA GAEA cluster.
def __init__(self)
constructor for NOAAGAEA
Represents the Yellowstone cluster.
def name()
Synonym for here.name.
This subclass of NOAAWCOSS handles the new Cray portions of WCOSS.
def longname()
Synonym for here.longname.
production
True if this system is production (real-time forecasting) environment, and False otherwise.
name
a short name of this cluster.
longname
a long name of this cluster.
Represents the NOAA Zeus cluster.
def production(self)
Is this the WCOSS production machine? No.