Parameter

This module defines a classs for a generic Workflow Parameter. It also defines a ParameterCollection class as a list of parameters as well as an AttributeCollection class which is the base class for the main Workflow classes.

class DIRAC.Core.Workflow.Parameter.AttributeCollection

Bases: dict

Attribute Collection class contains Parameter Collection as a data member

__init__()

x.__init__(…) initializes x; see help(type(x)) for signature

addParameter(opt, prefix='', postfix='')
addParameterLinked(opt, prefix='', postfix='')
clear() → None. Remove all items from D.
compare(s)
compareParameters(s)
copy() → a shallow copy of D
findParameter(name_or_ind)
findParameterIndex(ind)
fromkeys(S[, v]) → New dict with keys from S and values equal to v.

v defaults to None.

get(k[, d]) → D[k] if k in D, else d. d defaults to None.
getBody()
getDescrShort()
getDescription()
getName()
getOrigin()
getParent()
getRequired()
getType()
getVersion()
has_key(k) → True if D has a key k, else False
items() → list of D's (key, value) pairs, as 2-tuples
iteritems() → an iterator over the (key, value) items of D
iterkeys() → an iterator over the keys of D
itervalues() → an iterator over the values of D
keys() → list of D's keys
linkUp(opt, prefix='', postfix='', objname='self')
pop(k[, d]) → v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised

popitem() → (k, v), remove and return some (key, value) pair as a

2-tuple; but raise KeyError if D is empty.

removeAllParameters()
removeParameter(name_or_ind)
resolveGlobalVars(wf_parameters=None, step_parameters=None)
setBody(body)
setDescrShort(descr_short)
setDescription(description)
setName(name)
setOrigin(origin)
setParent(parent)
setRequired(required)
setType(att_type)
setValue(name, value, type_=None)
setVersion(ver)
setdefault(k[, d]) → D.get(k,d), also set D[k]=d if k not in D
toXML()
toXMLFile(filename)
toXMLString()
update([E, ]**F) → None. Update D from dict/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values() → list of D's values
viewitems() → a set-like object providing a view on D's items
viewkeys() → a set-like object providing a view on D's keys
viewvalues() → an object providing a view on D's values
class DIRAC.Core.Workflow.Parameter.Parameter(name=None, value=None, type=None, linked_module=None, linked_parameter=None, typein=None, typeout=None, description=None, parameter=None)

Bases: object

__init__(name=None, value=None, type=None, linked_module=None, linked_parameter=None, typein=None, typeout=None, description=None, parameter=None)

x.__init__(…) initializes x; see help(type(x)) for signature

compare(s)
copy(parameter)
createParameterCode(ind=0, instance_name=None)
getDescription()
getLinkedModule()
getLinkedParameter()
getName()
getType()
getValue()
getValueTypeCorrected()
isInput()
isLinked()
isOutput()
isTypeString()

returns True if type is the string kind

preExecute()

method to request watever parameter need to be defined before calling execute method returns TRUE if it needs to be done, FALSE otherwise PS: parameters with the output status only going to be left out

setDescription(descr)
setInput(i)
setName(n)
setOutput(i)
setType(type_)
setValue(value, type_=None)
setValueByType(value)
toXML()
class DIRAC.Core.Workflow.Parameter.ParameterCollection(coll=None)

Bases: list

Parameter collection class representing a list of Parameters

__init__(coll=None)

x.__init__(…) initializes x; see help(type(x)) for signature

append(opt)

L.append(object) – append object to end

appendCopy(opt, prefix='', postfix='')
appendCopyLinked(opt, prefix='', postfix='')
appendOrOverwrite(opt)
compare(s)
count(value) → integer -- return number of occurrences of value
createParametersCode(indent=0, instance_name=None)
extend()

L.extend(iterable) – extend list by appending elements from the iterable

find(name_or_ind)

Method to find Parameters Return: Parameter

findIndex(name)
findLinked(name_or_ind, linked_status=True)

Method to find Parameters if linked_status is True it returns only linked Var from the list if linked_status is False it returns only NOTlinked Var from the list Return: Parameter

get(input=False, output=False)

Get a copy of parameters. If input or output is True, get corresponding io type parameters only. Otherwise, get all the parameters

getInput()

Get input linked parameters

getLinked()

Get linked parameters

getOutput()

Get output linked parameters

getParametersNames()
index(value[, start[, stop]]) → integer -- return first index of value.

Raises ValueError if the value is not present.

insert()

L.insert(index, object) – insert object before index

linkUp(opt, prefix='', postfix='', objname='self')

This is a GROUP method operates on the ‘obj’ parameters using only parameters listed in ‘opt’ list Method will link self.parameters with the outer object (self) perameters using prefix and postfix for example if we want to link module instance with the step or step instance with the workflow opt - ParameterCollection or sigle Parameter (WARNING!! used as reference to get a names!!! opt is not changing!!!) opt ALSO can be a list of string with the names of parameters to link objname - name of the object to connect with, usually ‘self’

pop([index]) → item -- remove and return item at index (default last).

Raises IndexError if list is empty or index is out of range.

remove(name_or_ind)

Removes a parameter given its name, or the index (the latter is not suggested), and only if it exists

If there are 2 parameters with the same name, only the first will be removed

removeAllParameters()
resolveGlobalVars(wf_parameters=None, step_parameters=None)

This function resolves global parameters of type @{value} within the ParameterCollection

reverse()

L.reverse() – reverse IN PLACE

Method finds parameter with the name “name” and if exists its set value Returns True if sucsessfull

setValue(name, value, vtype=None)

Method finds parameter with the name “name” and if exists its set value Returns True if sucsessfull

sort()

L.sort(cmp=None, key=None, reverse=False) – stable sort IN PLACE; cmp(x, y) -> -1, 0, 1

toXML()

This is a GROUP method operates on the ‘obj’ parameters using only parameters listed in ‘opt’ list Method will unlink some self.parameters opt - ParameterCollection or sigle Parameter (WARNING!! used as reference to get a names!!! opt is not changing!!!) opt ALSO can be a list of string with the names of parameters to link objname - name of the object to connect with, usually ‘self’

DIRAC.Core.Workflow.Parameter.indent(indent=0)