Exemplo n.º 1
0
 def _createTaskGroupFromJSON(self, taskGroupDefinition, user):
     # name, parent, arguments, environment, priority, dispatchKey, strategy
     id = None
     name = taskGroupDefinition["name"]
     parent = None
     arguments = taskGroupDefinition["arguments"]
     environment = taskGroupDefinition["environment"]
     requirements = taskGroupDefinition["requirements"]
     maxRN = taskGroupDefinition["maxRN"]
     priority = taskGroupDefinition["priority"]
     dispatchKey = taskGroupDefinition["dispatchKey"]
     strategy = taskGroupDefinition["strategy"]
     strategy = loadStrategyClass(strategy.encode())
     strategy = strategy()
     tags = taskGroupDefinition["tags"]
     timer = None
     if "timer" in taskGroupDefinition.keys():
         timer = taskGroupDefinition["timer"]
     return TaskGroup(
         id,
         name,
         parent,
         user,
         arguments,
         environment,
         requirements,
         maxRN,
         priority,
         dispatchKey,
         strategy,
         tags=tags,
         timer=timer,
     )
Exemplo n.º 2
0
 def _createTaskGroupFromJSON(self, taskGroupDefinition, user):
     # name, parent, arguments, environment, priority, dispatchKey, strategy
     id = None
     name = taskGroupDefinition['name']
     parent = None
     arguments = taskGroupDefinition['arguments']
     environment = taskGroupDefinition['environment']
     requirements = taskGroupDefinition['requirements']
     maxRN = taskGroupDefinition['maxRN']
     priority = taskGroupDefinition['priority']
     dispatchKey = taskGroupDefinition['dispatchKey']
     strategy = taskGroupDefinition['strategy']
     strategy = loadStrategyClass(strategy.encode())
     strategy = strategy()
     tags = taskGroupDefinition['tags']
     timer = None
     if 'timer' in taskGroupDefinition.keys():
         timer = taskGroupDefinition['timer']
     return TaskGroup(id,
                      name,
                      parent,
                      user,
                      arguments,
                      environment,
                      requirements,
                      maxRN,
                      priority,
                      dispatchKey,
                      strategy,
                      tags=tags,
                      timer=timer)
Exemplo n.º 3
0
 def put(self, nodeId):
     '''
     Pushes an order to change the strategy of the given node.
     Returns the ticket for this order.
     '''
     odict = self.getBodyAsJSON()
     strategyClassName = odict['strategy']
     node = self._findNode(nodeId)
     if not isinstance(node, FolderNode):
         raise NotFolderInstanceError('Cannot set strategy on node %d: node is not a folder.' % int(nodeId))
     from octopus.dispatcher.strategies import loadStrategyClass, StrategyImportError
     try:
         strategyClass = loadStrategyClass(strategyClassName)
     except StrategyImportError, e:
         raise Http400("Failed to set strategy: %s" % e)
 def _createTaskGroupFromJSON(self, taskGroupDefinition, user):
     # name, parent, arguments, environment, priority, dispatchKey, strategy
     id = None
     name = taskGroupDefinition['name']
     parent = None
     arguments = taskGroupDefinition['arguments']
     environment = taskGroupDefinition['environment']
     requirements = taskGroupDefinition['requirements']
     maxRN = taskGroupDefinition['maxRN']
     priority = taskGroupDefinition['priority']
     dispatchKey = taskGroupDefinition['dispatchKey']
     strategy = taskGroupDefinition['strategy']
     strategy = loadStrategyClass(strategy.encode())
     strategy = strategy()
     tags = taskGroupDefinition['tags']
     return TaskGroup(id, name, parent, user, arguments, environment, requirements,
                      maxRN, priority, dispatchKey, strategy, tags=tags)
Exemplo n.º 5
0
 def put(self, nodeId):
     '''
     Pushes an order to change the strategy of the given node.
     Returns the ticket for this order.
     '''
     odict = self.getBodyAsJSON()
     strategyClassName = odict['strategy']
     node = self._findNode(nodeId)
     if not isinstance(node, FolderNode):
         raise NotFolderInstanceError(
             'Cannot set strategy on node %d: node is not a folder.' %
             int(nodeId))
     from octopus.dispatcher.strategies import loadStrategyClass, StrategyImportError
     try:
         strategyClass = loadStrategyClass(strategyClassName)
     except StrategyImportError, e:
         raise Http400("Failed to set strategy: %s" % e)