Classes | |
class | ProgressBar |
Functions | |
def | make_curl () |
def | filename_to_namespace (filename) |
def | get_file_qos (c, filename) |
def | is_file_online (c, filename) |
def | request_prestage (c, filename) |
def | is_file_online_pnfs (f) |
def | FilelistCacheCount (files, verbose_flag, METHOD="rest") |
def | FilelistPrestageRequest (files, verbose_flag) |
def | enstore_locations_to_paths (samlist, sparsification=1) |
Variables | |
X509_USER_PROXY = os.getenv("X509_USER_PROXY", "/tmp/x509up_u%d" % os.getuid()) | |
PNFS_DIR_PATTERN = re.compile(r"/pnfs/(?P<area>[^/]+)") | |
ENSTORE_PATTERN = re.compile(r"^enstore:([^(]+)(\([^)]+\))?") | |
string | DCACHE_REST_BASE_URL = "https://fndca.fnal.gov:3880/api/v1/namespace" |
parser = argparse.ArgumentParser(epilog=examples, formatter_class=argparse.RawDescriptionHelpFormatter) | |
gp = parser.add_mutually_exclusive_group() | |
nargs | |
default | |
metavar | |
help | |
dest | |
type | |
int | |
action | |
False | |
choices | |
args = parser.parse_args() | |
stdout | |
stderr | |
filelist = Noneifargs.dataset_nameelseargs.files | |
sam = swc.SAMWebClient("dune") | |
int | cache_count = 0 |
dataset_name | |
end | |
dimensions = None | |
samlist = sam.listFilesAndLocations(dimensions=dimensions, filter_path="enstore") | |
thislist = sam.listFiles(defname=args.dataset_name) | |
int | a = 0 |
locs = sam.locateFile(f) | |
l = loc["location"] | |
m = ENSTORE_PATTERN.match(l) | |
directory = m.group(1) | |
fullpath = os.path.join(directory, f) | |
f | |
file | |
int | miss_count = 0 |
n_files = len(filelist) | |
int | announce = n_files>1 |
ngood | |
n | |
pending_count | |
total = float(cache_count + miss_count) | |
int | cache_frac_str = (" (%d%%)" % round(cache_count/total*100))iftotal>0 |
int | miss_frac_str = (" (%d%%)" % round(miss_count/total*100))iftotal>0 |
string | pending_string = "" |
def cache_state.enstore_locations_to_paths | ( | samlist, | |
sparsification = 1 |
|||
) |
Convert a list of enstore locations as returned by samweb.listFilesAndLocations() into plain pnfs paths. Sparsify by `sparsification`
Definition at line 245 of file cache_state.py.
def cache_state.FilelistCacheCount | ( | files, | |
verbose_flag, | |||
METHOD = "rest" |
|||
) |
Definition at line 186 of file cache_state.py.
def cache_state.FilelistPrestageRequest | ( | files, | |
verbose_flag | |||
) |
Definition at line 228 of file cache_state.py.
def cache_state.filename_to_namespace | ( | filename | ) |
Definition at line 80 of file cache_state.py.
def cache_state.get_file_qos | ( | c, | |
filename | |||
) |
Using curl object `c`, find the "QoS" of `filename`. QoS is "disk", "tape" or "disk+tape", with the obvious meanings Returns: (currentQos, targetQos) where targetQos is non-empty if there is an outstanding prestage request. currentQos will be empty if there is an error (eg, file does not exist) Uses the dcache REST API frontend, documented in the dcache User Guide, eg: https://www.dcache.org/manuals/UserGuide-6.0/frontend.shtml
Definition at line 92 of file cache_state.py.
def cache_state.is_file_online | ( | c, | |
filename | |||
) |
Using curl object `c`, returns whether `filename` is online
Definition at line 143 of file cache_state.py.
def cache_state.is_file_online_pnfs | ( | f | ) |
Definition at line 177 of file cache_state.py.
def cache_state.make_curl | ( | ) |
Returns a pycurl object with the necessary fields set for Fermilab authentication. The object can be reused for multiple requests to the dcache REST API and curl will reuse the connection, which should speed things up
Definition at line 61 of file cache_state.py.
def cache_state.request_prestage | ( | c, | |
filename | |||
) |
Using curl object `c`, request a prestage for `filename` Returns whether the request succeeded (according to dcache) Uses a HTTP post request in a very specific format to request a prestage of a file. Adapted from: https://github.com/DmitryLitvintsev/scripts/blob/master/bash/bring-online.sh Uses the dcache REST API frontend, documented in the dcache User Guide, eg: https://www.dcache.org/manuals/UserGuide-6.0/frontend.shtml
Definition at line 148 of file cache_state.py.
int cache_state.a = 0 |
Definition at line 357 of file cache_state.py.
cache_state.action |
Definition at line 317 of file cache_state.py.
Definition at line 427 of file cache_state.py.
cache_state.args = parser.parse_args() |
Definition at line 321 of file cache_state.py.
cache_state.cache_count = 0 |
Definition at line 336 of file cache_state.py.
int cache_state.cache_frac_str = (" (%d%%)" % round(cache_count/total*100))iftotal>0 |
Definition at line 437 of file cache_state.py.
cache_state.choices |
Definition at line 319 of file cache_state.py.
cache_state.dataset_name |
Definition at line 342 of file cache_state.py.
string cache_state.DCACHE_REST_BASE_URL = "https://fndca.fnal.gov:3880/api/v1/namespace" |
Definition at line 32 of file cache_state.py.
cache_state.default |
Definition at line 300 of file cache_state.py.
cache_state.dest |
Definition at line 306 of file cache_state.py.
string cache_state.dimensions = None |
Definition at line 345 of file cache_state.py.
cache_state.directory = m.group(1) |
Definition at line 417 of file cache_state.py.
cache_state.end |
Definition at line 342 of file cache_state.py.
cache_state.ENSTORE_PATTERN = re.compile(r"^enstore:([^(]+)(\([^)]+\))?") |
Definition at line 26 of file cache_state.py.
cache_state.f |
Definition at line 421 of file cache_state.py.
cache_state.False |
Definition at line 317 of file cache_state.py.
cache_state.file |
Definition at line 421 of file cache_state.py.
list cache_state.filelist = Noneifargs.dataset_nameelseargs.files |
Definition at line 332 of file cache_state.py.
Definition at line 418 of file cache_state.py.
cache_state.gp = parser.add_mutually_exclusive_group() |
Definition at line 297 of file cache_state.py.
cache_state.help |
Definition at line 302 of file cache_state.py.
cache_state.int |
Definition at line 315 of file cache_state.py.
cache_state.l = loc["location"] |
Definition at line 414 of file cache_state.py.
cache_state.locs = sam.locateFile(f) |
Definition at line 360 of file cache_state.py.
cache_state.m = ENSTORE_PATTERN.match(l) |
Definition at line 415 of file cache_state.py.
cache_state.metavar |
Definition at line 301 of file cache_state.py.
cache_state.miss_count = 0 |
Definition at line 424 of file cache_state.py.
int cache_state.miss_frac_str = (" (%d%%)" % round(miss_count/total*100))iftotal>0 |
Definition at line 438 of file cache_state.py.
cache_state.n |
Definition at line 430 of file cache_state.py.
cache_state.n_files = len(filelist) |
Definition at line 426 of file cache_state.py.
cache_state.nargs |
Definition at line 299 of file cache_state.py.
cache_state.ngood |
Definition at line 430 of file cache_state.py.
cache_state.parser = argparse.ArgumentParser(epilog=examples, formatter_class=argparse.RawDescriptionHelpFormatter) |
Definition at line 295 of file cache_state.py.
cache_state.pending_count |
Definition at line 433 of file cache_state.py.
string cache_state.pending_string = "" |
Definition at line 442 of file cache_state.py.
cache_state.PNFS_DIR_PATTERN = re.compile(r"/pnfs/(?P<area>[^/]+)") |
Definition at line 20 of file cache_state.py.
cache_state.sam = swc.SAMWebClient("dune") |
Definition at line 334 of file cache_state.py.
list cache_state.samlist = sam.listFilesAndLocations(dimensions=dimensions, filter_path="enstore") |
Definition at line 351 of file cache_state.py.
cache_state.stderr |
Definition at line 327 of file cache_state.py.
cache_state.stdout |
Definition at line 327 of file cache_state.py.
cache_state.thislist = sam.listFiles(defname=args.dataset_name) |
Definition at line 354 of file cache_state.py.
cache_state.total = float(cache_count + miss_count) |
Definition at line 433 of file cache_state.py.
cache_state.type |
Definition at line 315 of file cache_state.py.
cache_state.X509_USER_PROXY = os.getenv("X509_USER_PROXY", "/tmp/x509up_u%d" % os.getuid()) |
Definition at line 19 of file cache_state.py.