Functions | Variables
snapshotDefinitions Namespace Reference

Functions

def doesDefinitionExist (defname)
 
def makeSnapshotDefinition (defname)
 

Variables

 prog = sys.argv[0]
 
 parser = argparse.ArgumentParser(prog=prog, description='Create archival definitions based on snapshots')
 
 srcOptions = parser.add_mutually_exclusive_group(required=True)
 
 help
 
 type
 
 reqOptions = parser.add_argument_group("Required argument", "Required Argument")
 
 required
 
 optOptions = parser.add_argument_group("Optional Arguments", "Optional Arguments")
 
 default
 
 False
 
 action
 
 args = parser.parse_args()
 
 sam = samweb_client.SAMWebClient(experiment='nova')
 
 role
 
 defname = args.definition
 
 cfg = PageConfig(args.pageConfig)
 
 definition = chain.tierData[tier]
 

Function Documentation

def snapshotDefinitions.doesDefinitionExist (   defname)

Definition at line 41 of file snapshotDefinitions.py.

Referenced by makeSnapshotDefinition().

41 def doesDefinitionExist(defname):
42  try:
43  sam.descDefinitionDict(defname)
44  return True
46  return False
47 
def doesDefinitionExist(defname)
def snapshotDefinitions.makeSnapshotDefinition (   defname)

Definition at line 48 of file snapshotDefinitions.py.

References doesDefinitionExist().

49  newname = defname + "_" + args.name
50 
51  if doesDefinitionExist(newname):
52  if args.force:
53  print "%s already exists, removing it"%defname
54  sam.deleteDefinition(newname)
55  else:
56  print "%s already exists, skipping"% defname
57  return
58 
59  try:
60  print "Snapshotting %s"%defname
61  snapshotID = sam.takeSnapshot(defname)
62  dims = "snapshot_id %d" % snapshotID
63  result = sam.createDefinition(newname, dims, os.environ['USER'], os.environ['GROUP'], "Fixed snapshot of %s" % defname)
64  print "Dataset definition '%s' has been created with id %s" % (result["defname"], result["defid"])
65 
67  print "ERROR, definition %s not found" % defname, "skipping"
69  print "ERROR, Timeout getting data for %s" % defname, "skipping"
71  print "Samweb SSL error. Get a new certificate."
72  sys.exit(3)
73 
74 
75 
def makeSnapshotDefinition(defname)
def doesDefinitionExist(defname)

Variable Documentation

snapshotDefinitions.action

Definition at line 32 of file snapshotDefinitions.py.

snapshotDefinitions.args = parser.parse_args()

Definition at line 35 of file snapshotDefinitions.py.

snapshotDefinitions.cfg = PageConfig(args.pageConfig)

Definition at line 81 of file snapshotDefinitions.py.

snapshotDefinitions.default

Definition at line 32 of file snapshotDefinitions.py.

snapshotDefinitions.definition = chain.tierData[tier]

Definition at line 85 of file snapshotDefinitions.py.

snapshotDefinitions.defname = args.definition

Definition at line 77 of file snapshotDefinitions.py.

Referenced by plot_spectra_2dplots().

snapshotDefinitions.False

Definition at line 32 of file snapshotDefinitions.py.

snapshotDefinitions.help

Definition at line 14 of file snapshotDefinitions.py.

snapshotDefinitions.optOptions = parser.add_argument_group("Optional Arguments", "Optional Arguments")

Definition at line 30 of file snapshotDefinitions.py.

snapshotDefinitions.parser = argparse.ArgumentParser(prog=prog, description='Create archival definitions based on snapshots')

Definition at line 9 of file snapshotDefinitions.py.

snapshotDefinitions.prog = sys.argv[0]

Definition at line 8 of file snapshotDefinitions.py.

snapshotDefinitions.reqOptions = parser.add_argument_group("Required argument", "Required Argument")

Definition at line 25 of file snapshotDefinitions.py.

snapshotDefinitions.required

Definition at line 27 of file snapshotDefinitions.py.

snapshotDefinitions.role

Definition at line 39 of file snapshotDefinitions.py.

snapshotDefinitions.sam = samweb_client.SAMWebClient(experiment='nova')

Definition at line 38 of file snapshotDefinitions.py.

snapshotDefinitions.srcOptions = parser.add_mutually_exclusive_group(required=True)

Definition at line 11 of file snapshotDefinitions.py.

snapshotDefinitions.type

Definition at line 15 of file snapshotDefinitions.py.