assets

how to create a new asset:

tba.

Base Classes:

assets-import

Module will load a dictionary (allAssets) holding the link between Module-Name and Class. It can be used to automatically create different assets

DataElement

class pipeLion.core.dataElement.DataElement(name, project, id=None)[source]

the dataElement-class is the base-class for any data-type stored in the data-base. It has functionality to gather a unique ID for the object loading up versions which were stored in the data-base before, publish(save) an object in the data-base and manage the version contol of an object.

DataElement has an OrderedDict instance-variable -called assetDict-, which stores all properties and settings of the current object, which should be stored in the database. In addition to that DataElement creates for each entry in this dictionary two instance-methods called DataElement.[ATTRIBUTE-NAME] and DataElement.set_[ATTRIBUTE-NAME], which can be used to change the values of the attributes.

InObjects, which are derived by DataElement the assetDict can be extended by using the instance-variable: DataElement.additionalAssetDict

To load an object which is derived by DataElement and was stored in the database before, it is possible to use the DataElement.fromAssetDict classmethod.

additionalAssetDict = OrderedDict()

with this Dict the __mandatoryAssetDict can be extended in derived classes

additionalInitializeFromAssetDict(assetDict)[source]

This method can be reimplemented in case the derived class needs to add additional steps to load up the Node

classmethod fromAssetDict(id, assetDict)[source]

classmethod will return an instance the object, which is stored in the database, which matches to the given Id and will set all it’s attributes according to the given assetDict

Parameters:
  • id (Id) – id of the Node which should be loaded
  • assetDict (dictionary) – all settings which are needed to recreate an existing Node. assetDict will update the instanceVariable assetDict of the newly created Node
Returns:

a new instance of the class, which matches the type-attribute in the assetDict

Return type:

DataElement

getAssetDict()[source]

returns the assetDict of this Node

Returns:assetDict instance variable
Return type:dictionary
postPublish(recursive=True)[source]

this method can be reimplemented in case the Node has to be setup after publishing is done

Parameters:recursive (bool) – indicates if the publish call should recursevely call all childNodes as well
prePublish(recursive=True)[source]

this method can be reimplemented in case the Node has to be setup before publishing it to the dataBase

Parameters:recursive (bool) – indicates if the publish call should recursevely call all childNodes as well
publish(recursive=True)[source]

this method will publish the current Node with all its settings to the dataBase in a new generated version. if derived classes need to setup the attributes in any way, before and/or after publishing, the two functions prePublish and postPublish can be reimplemented!

Parameters:recursive (bool) – indicates if the publish should go though all children of this node as well
setProperty(property, value)[source]

method will change a property in the assetDict directly, without using the generated lambda-functions

Parameters:
  • property (string) – the name of the attribute, whoch should be changed in the assetDict
  • value (variant object) – value, the property should be set to
Returns:

the updated assetDict

Return type:

dictionary

static setSettingsFromDict(instance, assetDict)[source]

method will iter over each key of a given attribute and assign its value to the assetDict of the given instance

Parameters:
  • instance (DataElement) – the instance of which the assetDict should be changed
  • assetDict (dictionary) – the dictionary which is used to update the node given by instance
setupFunctions()[source]

method will setup the instance-methods, which are needed to set, get or delete values in the self.assetDict instance-variable for each attribute stored in the assetDict instance-variable the will be the following functions generated: setter-> set_ATTRIBUTENAME(value) getter-> ATTRIBUTENAME() deleter-> del_ATTRIBUTENAME()

AbstractAsset

class pipeLion.assets.abstractAsset.AbstractAsset(name, project, id=None)[source]

AbstractAsset is derived by DataElement and is therefore a Node which can be published and version-controled.

AbstractAsset has functionality to connect to other Nodes and assigning a user to it.

Each AbstractAsset gas an extended assetDict compared to the default mandatoryAssetDict of DataElement

addInputType(connectionName)[source]

method will update the _inputDict instance variable, which holds a key for each possible connection and assigns a list to it, which can be filled as soon as a connected asset can use a connection

Parameters:connectionName (string) – classname of the desired connection-types
Returns:the _inputDict instance variable
Return type:dictionary
addOutputType(connectionName)[source]

similar to setOutput but instead of a list, this function takes a single string

Parameters:connectionName (string) – class-name of the connection-object, which should be appended
Returns:_outputList instance variable
Return type:list of AbstractConnection
additionalInitializeFromAssetDict(assetDict)[source]

this method is a reimplementment of DataElement to be able to set the possible connections correctly

assignUser(user)[source]

method will assign a user to this asset

Parameters:user (User) – user who should be assigned to this asset
children[source]

property will return a list of connected children

connect(asset)[source]

connects a node to another AbstractAsset derived Node

Parameters:asset (AbstractAsset) – Node, which should become a dependency of this Node.
deassignUser()[source]

method deassignes the user, who is currently assigned

defaultOutput[source]

will return the first item in the outputList as default output

Returns:the first item of all outputs and None if _outputList is empty
Return type:None or AbstractConnection
disconnect(asset)[source]

method disconnects a given asset from this Node :param asset: Node, which should be disconnected :type asset: AbstractAsset

classmethod fromAssetDict(id, assetDict)

classmethod will return an instance the object, which is stored in the database, which matches to the given Id and will set all it’s attributes according to the given assetDict

Parameters:
  • id (Id) – id of the Node which should be loaded
  • assetDict (dictionary) – all settings which are needed to recreate an existing Node. assetDict will update the instanceVariable assetDict of the newly created Node
Returns:

a new instance of the class, which matches the type-attribute in the assetDict

Return type:

DataElement

getAllInputs()[source]

method will return the _inputDict instance variable

Returns:_inputDict instance variable
Return type:dictionary
getAllOutputs()[source]

method will return the _outputList instance variable

Returns:_outputList instance variable
Return type:list of AbstractConnection
getAssetDict()

returns the assetDict of this Node

Returns:assetDict instance variable
Return type:dictionary
getAssetUrgency()[source]

this method calculates the urgency of this asset by comparing the state() attribute to the start_date() and end_date() attribute and setting these attributes in relation to the current date

Returns:state as -1=not urgent, 0=moderately urgent, 1=urgent, 2=highest priority
Return type:int
getDependencies(recursive=False)[source]

method will list all objects which are dependencies of this Node :param recursive: indicates if only teh direct dependencies(False, default) should be listed or even the indirect dependencies (dependencies of dependencies) :type recursive: bool

Returns:a list of AbstractAsset-derivates
Return type:list
getInput(connectionName)[source]

get a certain entry in the _inputDict instance variable

Parameters:connectionName (string) – classname of the AbstractConnection-class which should be returned
Returns:list of connected AbstractConnection objects
Return type:list of AbstractConnection
getProject[source]

method will search recursively for the connected project-Node

Returns:the project-node connected to this node
Return type:Project
getShot[source]

method will search recursively for the connected project-Node

Returns:the project-node connected to this node
Return type:Project
isPlannedOnDate(date)[source]

method will return if this asset is scheduled at the given date

Parameters:date (datetime.datetime) – the date which is to be checked
Returns:if this asset is scheduled at the given date
Return type:boolean
postPublish(recursive=True)[source]

function is a reimplementment of the postPublish function of DataElement for more information to switch back the baseId in user() to a user-object

prePublish(recursive=True)[source]

function is a reimplementment of the prePublish function of DataElement for more information to switch the user -object to a baseId object

publish(recursive=True)

this method will publish the current Node with all its settings to the dataBase in a new generated version. if derived classes need to setup the attributes in any way, before and/or after publishing, the two functions prePublish and postPublish can be reimplemented!

Parameters:recursive (bool) – indicates if the publish should go though all children of this node as well
removeInput(connectionName)[source]

remove a connection from the _inputDict instance variable :param connectionName: classname of the AbstractConnection-class which should be deleted :type connectionName: string

Returns:_inputDict
Return type:dictionary
removeInputType(connectionName)[source]

method will remove one entry from the _inputDict instance variable

Parameters:connectionName (string) – classname of the desired connection-types
Returns:the _inputDict instance variable
Return type:dictionary
removeOutput(connection)[source]

will remove a given connection instance from the _outputList

Parameters:connection (AbstractConnection) – connection-object
removeOutputType(connectionName)[source]

removes a certain connectionInstance from the _outputList instance variable

Parameters:connectionName (string) – class-name of the connection-object, which should be appended
Returns:_outputList instance variable
Return type:list of AbstractConnection
setInput(connection)[source]

adds a connection-Object to the _inputDict instance variable of this Node this will in the end define if two Nodes are connected or not.

Parameters:connection (AbstractConnection) – connection-object
Returns:returns a success-boolean
Return type:bool
setInputTypes(connectionNameList)[source]

method will update the _inputDict instance variable, which holds a key for each possible connection and assigns a list to it, which can be filled as soon as a connected asset can use a connection

Parameters:connectionNameList (list of strings) – list of the classnames of the desired connection-types
Returns:the _inputDict instance variable
Return type:dictionary
setOutput(connectionNameList)[source]

similar to setInputTypes but it will add for each entry in connectionNameList a connection-object-instance which can be used for connecting later on

Parameters:connectionNameList (list) – list of class-name sof the connection-objects, which should be appended
Returns:_outputList instance variable
Return type:list of AbstractConnection
setProperty(property, value)

method will change a property in the assetDict directly, without using the generated lambda-functions

Parameters:
  • property (string) – the name of the attribute, whoch should be changed in the assetDict
  • value (variant object) – value, the property should be set to
Returns:

the updated assetDict

Return type:

dictionary

static setSettingsFromDict(instance, assetDict)

method will iter over each key of a given attribute and assign its value to the assetDict of the given instance

Parameters:
  • instance (DataElement) – the instance of which the assetDict should be changed
  • assetDict (dictionary) – the dictionary which is used to update the node given by instance
setupFunctions()

method will setup the instance-methods, which are needed to set, get or delete values in the self.assetDict instance-variable for each attribute stored in the assetDict instance-variable the will be the following functions generated: setter-> set_ATTRIBUTENAME(value) getter-> ATTRIBUTENAME() deleter-> del_ATTRIBUTENAME()

verifyInput(connection)[source]

method will return True in case connection is able to connect to the _inputDict of this node

Parameters:connection (AbstractConnection) – connection-object
Returns:if True node and connection can connect, if False the can’t
Return type:bool

AbstractGroup

class pipeLion.assets.abstractGroup.AbstractGroup(name, project, id=None)[source]

AbstractGroup is derived by AbstractAsset and defines a groupAsset

group assets have the special behaviour, that their timespan as well as their user is the sum of all dependent nodes.

addInputType(connectionName)

method will update the _inputDict instance variable, which holds a key for each possible connection and assigns a list to it, which can be filled as soon as a connected asset can use a connection

Parameters:connectionName (string) – classname of the desired connection-types
Returns:the _inputDict instance variable
Return type:dictionary
addOutputType(connectionName)

similar to setOutput but instead of a list, this function takes a single string

Parameters:connectionName (string) – class-name of the connection-object, which should be appended
Returns:_outputList instance variable
Return type:list of AbstractConnection
additionalInitializeFromAssetDict(assetDict)

this method is a reimplementment of DataElement to be able to set the possible connections correctly

assignUser(user)

method will assign a user to this asset

Parameters:user (User) – user who should be assigned to this asset
bidDays()[source]

is the substraction of end_date and start_date

Returns:the bidDays of all dependent nodes combined
Return type:int
children

property will return a list of connected children

connect(asset)

connects a node to another AbstractAsset derived Node

Parameters:asset (AbstractAsset) – Node, which should become a dependency of this Node.
deassignUser()

method deassignes the user, who is currently assigned

defaultOutput

will return the first item in the outputList as default output

Returns:the first item of all outputs and None if _outputList is empty
Return type:None or AbstractConnection
disconnect(asset)

method disconnects a given asset from this Node :param asset: Node, which should be disconnected :type asset: AbstractAsset

endDate()[source]

method reimoplements the end_date attribute of the assetDict

Returns:the largest date of all dependent nodes
Return type:datetime.datetime
classmethod fromAssetDict(id, assetDict)

classmethod will return an instance the object, which is stored in the database, which matches to the given Id and will set all it’s attributes according to the given assetDict

Parameters:
  • id (Id) – id of the Node which should be loaded
  • assetDict (dictionary) – all settings which are needed to recreate an existing Node. assetDict will update the instanceVariable assetDict of the newly created Node
Returns:

a new instance of the class, which matches the type-attribute in the assetDict

Return type:

DataElement

getAllInputs()

method will return the _inputDict instance variable

Returns:_inputDict instance variable
Return type:dictionary
getAllOutputs()

method will return the _outputList instance variable

Returns:_outputList instance variable
Return type:list of AbstractConnection
getAssetDict()

returns the assetDict of this Node

Returns:assetDict instance variable
Return type:dictionary
getAssetUrgency()

this method calculates the urgency of this asset by comparing the state() attribute to the start_date() and end_date() attribute and setting these attributes in relation to the current date

Returns:state as -1=not urgent, 0=moderately urgent, 1=urgent, 2=highest priority
Return type:int
getDependencies(recursive=False)

method will list all objects which are dependencies of this Node :param recursive: indicates if only teh direct dependencies(False, default) should be listed or even the indirect dependencies (dependencies of dependencies) :type recursive: bool

Returns:a list of AbstractAsset-derivates
Return type:list
getInput(connectionName)

get a certain entry in the _inputDict instance variable

Parameters:connectionName (string) – classname of the AbstractConnection-class which should be returned
Returns:list of connected AbstractConnection objects
Return type:list of AbstractConnection
getProject

method will search recursively for the connected project-Node

Returns:the project-node connected to this node
Return type:Project
getShot

method will search recursively for the connected project-Node

Returns:the project-node connected to this node
Return type:Project
groupState()[source]

returns the global state of all dependency tasks

Returns:the state of this groupAsset
Return type:int
groupUser()[source]

this method reimplements the user() attribute and will return a list of users instead,

Returns:list of User-objects.
Return type:list of User
isPlannedOnDate(date)

method will return if this asset is scheduled at the given date

Parameters:date (datetime.datetime) – the date which is to be checked
Returns:if this asset is scheduled at the given date
Return type:boolean
postPublish(recursive=True)

function is a reimplementment of the postPublish function of DataElement for more information to switch back the baseId in user() to a user-object

prePublish(recursive=True)

function is a reimplementment of the prePublish function of DataElement for more information to switch the user -object to a baseId object

publish(recursive=True)

this method will publish the current Node with all its settings to the dataBase in a new generated version. if derived classes need to setup the attributes in any way, before and/or after publishing, the two functions prePublish and postPublish can be reimplemented!

Parameters:recursive (bool) – indicates if the publish should go though all children of this node as well
removeInput(connectionName)

remove a connection from the _inputDict instance variable :param connectionName: classname of the AbstractConnection-class which should be deleted :type connectionName: string

Returns:_inputDict
Return type:dictionary
removeInputType(connectionName)

method will remove one entry from the _inputDict instance variable

Parameters:connectionName (string) – classname of the desired connection-types
Returns:the _inputDict instance variable
Return type:dictionary
removeOutput(connection)

will remove a given connection instance from the _outputList

Parameters:connection (AbstractConnection) – connection-object
removeOutputType(connectionName)

removes a certain connectionInstance from the _outputList instance variable

Parameters:connectionName (string) – class-name of the connection-object, which should be appended
Returns:_outputList instance variable
Return type:list of AbstractConnection
setInput(connection)

adds a connection-Object to the _inputDict instance variable of this Node this will in the end define if two Nodes are connected or not.

Parameters:connection (AbstractConnection) – connection-object
Returns:returns a success-boolean
Return type:bool
setInputTypes(connectionNameList)

method will update the _inputDict instance variable, which holds a key for each possible connection and assigns a list to it, which can be filled as soon as a connected asset can use a connection

Parameters:connectionNameList (list of strings) – list of the classnames of the desired connection-types
Returns:the _inputDict instance variable
Return type:dictionary
setOutput(connectionNameList)

similar to setInputTypes but it will add for each entry in connectionNameList a connection-object-instance which can be used for connecting later on

Parameters:connectionNameList (list) – list of class-name sof the connection-objects, which should be appended
Returns:_outputList instance variable
Return type:list of AbstractConnection
setProperty(property, value)

method will change a property in the assetDict directly, without using the generated lambda-functions

Parameters:
  • property (string) – the name of the attribute, whoch should be changed in the assetDict
  • value (variant object) – value, the property should be set to
Returns:

the updated assetDict

Return type:

dictionary

static setSettingsFromDict(instance, assetDict)

method will iter over each key of a given attribute and assign its value to the assetDict of the given instance

Parameters:
  • instance (DataElement) – the instance of which the assetDict should be changed
  • assetDict (dictionary) – the dictionary which is used to update the node given by instance
setupAdditionalGroupReimplementations()[source]

method reimplements certain attributes of the abstract asset which should be grouped together.

setupFunctions()

method will setup the instance-methods, which are needed to set, get or delete values in the self.assetDict instance-variable for each attribute stored in the assetDict instance-variable the will be the following functions generated: setter-> set_ATTRIBUTENAME(value) getter-> ATTRIBUTENAME() deleter-> del_ATTRIBUTENAME()

startDate()[source]

method reimoplements the start_date attribute of the assetDict

Returns:the smalles date of all dependent nodes
Return type:datetime.datetime
verifyInput(connection)

method will return True in case connection is able to connect to the _inputDict of this node

Parameters:connection (AbstractConnection) – connection-object
Returns:if True node and connection can connect, if False the can’t
Return type:bool

Table Of Contents

Previous topic

core classes

Next topic

implemented-connections

This Page