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__()
- 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)
- classmethod fromkeys(iterable, value=None, /)
Create a new dictionary with keys from iterable and values set to value.
- get(key, default=None, /)
Return the value for key if key is in the dictionary, else default.
- getBody()
- getDescrShort()
- getDescription()
- getName()
- getOrigin()
- getParent()
- getRequired()
- getType()
- getVersion()
- items() a set-like object providing a view on D's items
- keys() a set-like object providing a view on D's keys
- linkUp(opt, prefix='', postfix='', objname='self')
- pop(k[, d]) v, remove specified key and return the corresponding value.
If the key is not found, return the default if given; otherwise, raise a KeyError.
- popitem()
Remove and return a (key, value) pair as a 2-tuple.
Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.
- removeAllParameters()
- removeParameter(name_or_ind)
- resolveGlobalVars(wf_parameters=None, step_parameters=None)
- setBody(body)
- setDescrShort(descr_short)
- setDescription(description)
- setLink(name, module_name, parameter_name)
- setName(name)
- setOrigin(origin)
- setParent(parent)
- setRequired(required)
- setType(att_type)
- setValue(name, value, type_=None)
- setVersion(ver)
- setdefault(key, default=None, /)
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
- toXML()
- toXMLFile(filename)
- toXMLString()
- unlink(opt)
- update([E, ]**F) None. Update D from dict/iterable E and F.
If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then 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() 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)
- compare(s)
- copy(parameter)
- createParameterCode(ind=0, instance_name=None)
- getDescription()
- getLink()
- getLinkedModule()
- getLinkedParameter()
- getName()
- getType()
- getValue()
- getValueTypeCorrected()
- isInput()
- isLinked()
- isOutput()
- isTypeString()
returns True if type is the string kind
- link(module, parameter)
- 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()
- unlink()
- class DIRAC.Core.Workflow.Parameter.ParameterCollection(coll=None)
Bases:
list
Parameter collection class representing a list of Parameters
- __init__(coll=None)
- append(opt)
Append object to the end of the list.
- appendCopy(opt, prefix='', postfix='')
- appendCopyLinked(opt, prefix='', postfix='')
- appendOrOverwrite(opt)
- clear()
Remove all items from list.
- compare(s)
- copy()
Return a shallow copy of the list.
- count(value, /)
Return number of occurrences of value.
- createParametersCode(indent=0, instance_name=None)
- 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=0, stop=9223372036854775807, /)
Return first index of value.
Raises ValueError if the value is not present.
- 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 single 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=-1, /)
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()
Reverse IN PLACE.
- setLink(name, module_name, parameter_name)
Method finds parameter with the name “name” and if exists its set value Returns True if successful
- setValue(name, value, vtype=None)
Method finds parameter with the name “name” and if exists its set value Returns True if successful
- sort(*, key=None, reverse=False)
Sort the list in ascending order and return None.
The sort is in-place (i.e. the list itself is modified) and stable (i.e. the order of two equal elements is maintained).
If a key function is given, apply it once to each list item and sort them, ascending or descending, according to their function values.
The reverse flag can be set to sort in descending order.
- toXML()
- unlink(opt)
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 single 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)