Exemplo n.º 1
0
 def __init__(self):
     self.payload = PayloadNode()
     self.parameters = {}
     self.parameters.setdefault("WorkflowName", "Workflow-%s" % time.time())
     self.parameters.setdefault("RequestTimestamp", int(time.time()))
     self.parameters.setdefault("RequestCategory", "PreProd")
     self.parameters.setdefault("WorkflowType", "Processing")
     self.parameters.setdefault("WorkflowRunNumber", 1)
     self.parameters.setdefault("StreamerIndexDir", None)
     self.pythonLibs = []
     self._NodeMap = {}
Exemplo n.º 2
0
    def loadFromNode(self, improvNode):
        """
        _loadFromNode_

        Populate this object based on content of improvNode provided
        
        """
        paramQ = IMProvQuery("/WorkflowSpec/Parameter")
        payloadQ = IMProvQuery("/WorkflowSpec/Payload/PayloadNode")
        libsQ = IMProvQuery(
            "/WorkflowSpec/PythonLibraries/PythonLibrary[attribute(\"Name\")]")
        #  //
        # // Extract Params
        #//
        paramNodes = paramQ(improvNode)
        for item in paramNodes:
            paramName = item.attrs.get("Name", None)
            if paramName == None:
                continue
            paramValue = str(item.chardata)
            self.parameters[str(paramName)] = paramValue

        #  //
        # // Extract python lib list
        #//
        libNames = libsQ(improvNode)
        for item in libNames:
            self.addPythonLibrary(str(item))

        #  //
        # // Extract Payload Nodes
        #//
        payload = payloadQ(improvNode)[0]
        self.payload = PayloadNode()
        self.payload.populate(payload)
        return