Example #1
0
 def __init__(self, name, params):
     """
     :param name:
     :type name: str
     :param params:
     :type params: dict
     """
     params.update({'type': 'command'})
     AzkabanJobAbstruct.__init__(self, 'command', name, params)
Example #2
0
 def __init__(self, name, params=None, properties=None):
     """
     :param name: The name of flow.
     :param params: The parameters when this flow is used by sub-flow.
     :param properties: The properties affecting registered jobs under this flow.
     :type name: str
     :type params: dict
     :type properties: Properties or dict
     """
     params = params or {}
     params.update({'type': 'flow', 'flow.name': name})
     AzkabanJobAbstruct.__init__(self, 'flow', name, params)
     if properties is None:
         self.__properties = None
     elif isinstance(properties, Properties):
         self.__properties = properties
     elif isinstance(properties, dict):
         self.__properties = Properties(self.name, properties)
     else:
         raise TypeError("properties is dict or Properties. (actual: {0})".format(type(properties)))
     self.__graph = nx.DiGraph()
     self.__finish_command = Command(self.name, {'command': 'echo "Finish {0} at $(date)"'.format(self.name)})
     self.__graph.add_node(self.__finish_command)