Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update process schedule command to match the dashi command.

  • Loading branch information...
commit 51715b18fa0b4528329c8736a7102a5b06827035 1 parent f456863
@oldpatricka oldpatricka authored
Showing with 17 additions and 28 deletions.
  1. +9 −4 ceiclient/client.py
  2. +8 −24 ceiclient/commands.py
View
13 ceiclient/client.py
@@ -6,7 +6,7 @@
from commands import DTRSAddCredentials, DTRSDescribeCredentials, DTRSListCredentials, DTRSRemoveCredentials, DTRSUpdateCredentials
from commands import EPUMAdd, EPUMDescribe, EPUMList, EPUMReconfigure, EPUMRemove
from commands import EPUMAddDefinition, EPUMDescribeDefinition, EPUMListDefinitions, EPUMRemoveDefinition, EPUMUpdateDefinition
-from commands import PDSchedule, PDDescribeProcess, PDDescribeProcesses, PDTerminateProcess, PDDump, PDRestartProcess, PDWaitProcess
+from commands import PDScheduleProcess, PDDescribeProcess, PDDescribeProcesses, PDTerminateProcess, PDDump, PDRestartProcess, PDWaitProcess
from commands import PDCreateProcessDefinition, PDDescribeProcessDefinition, PDUpdateProcessDefinition, PDRemoveProcessDefinition, PDListProcessDefinitions
from commands import PyonPDCreateProcessDefinition, PyonPDUpdateProcessDefinition, PyonPDReadProcessDefinition, PyonPDDeleteProcessDefinition, PyonPDListProcessDefinitions
from commands import PyonPDAssociateExecutionEngine, PyonPDDissociateExecutionEngine
@@ -322,9 +322,14 @@ def __init__(self, connection, dashi_name=None):
self.dashi_name = dashi_name
self._connection = connection
- def schedule_process(self, upid, process_definition_id, subscribers, constraints):
+ def schedule_process(self, upid, process_definition_id, configuration=None,
+ subscribers=None, constraints=None, queueing_mode=None,
+ restart_mode=None, execution_engine_id=None, node_exclusive=None):
args = dict(upid=upid, definition_id=process_definition_id,
- subscribers=subscribers, constraints=constraints)
+ subscribers=subscribers, constraints=constraints,
+ configuration=configuration, queueing_mode=queueing_mode,
+ restart_mode=restart_mode, execution_engine_id=execution_engine_id,
+ node_exclusive=node_exclusive)
return self._connection.call(self.dashi_name, 'schedule_process',
args=args)
@@ -344,7 +349,7 @@ def dump(self):
return self._connection.call(self.dashi_name, 'dump')
commands = {}
- for command in [PDSchedule, PDDescribeProcess, PDDescribeProcesses, PDTerminateProcess, PDDump, PDRestartProcess, PDWaitProcess]:
+ for command in [PDScheduleProcess, PDDescribeProcess, PDDescribeProcesses, PDTerminateProcess, PDDump, PDRestartProcess, PDWaitProcess]:
commands[command.name] = command
View
32 ceiclient/commands.py
@@ -532,40 +532,24 @@ class PDScheduleProcess(CeiCommand):
def __init__(self, subparsers):
parser = subparsers.add_parser(self.name)
+ parser.add_argument('process_id', metavar='proc_id')
parser.add_argument('process_definition_id', metavar='pd_id')
parser.add_argument('configuration', metavar='process_configuration.yml')
- parser.add_argument('process_id', metavar='proc_id')
+ parser.add_argument('--queueing-mode', metavar='queueing_mode')
+ parser.add_argument('--restart-mode', metavar='restart_mode')
@staticmethod
def execute(client, opts):
- try:
- with open(opts.schedule) as f:
- schedule = yaml.load(f)
- except Exception, e:
- print "Problem reading process schedule file %s: %s" % (opts.schedule, e)
- sys.exit(1)
try:
with open(opts.configuration) as f:
configuration = yaml.load(f)
- except exception, e:
+ except Exception, e:
print "problem reading process configuration file %s: %s" % (opts.configuration, e)
sys.exit(1)
- return client.schedule_process(opts.process_definition_id, configuration, opts.process_id)
-
-
-class PDSchedule(CeiCommand):
-
- name = 'schedule'
-
- def __init__(self, subparsers):
-
- parser = subparsers.add_parser(self.name)
- parser.add_argument('process_definition_id', metavar='pd_id')
-
- @staticmethod
- def execute(client, opts):
- return client.schedule_process(str(uuid.uuid4().hex), opts.process_definition_id, None, None)
+ return client.schedule_process(opts.process_id, opts.process_definition_id,
+ configuration=configuration, queueing_mode=opts.queueing_mode,
+ restart_mode=opts.restart_mode)
class PDDescribeProcesses(CeiCommand):
@@ -642,7 +626,7 @@ def execute(client, opts):
if process:
state = process['state']
- if state == "500-RUNNING":
+ if state in ("500-RUNNING", "800-EXITED"):
return process
if state in ("850-FAILED", "900-REJECTED"):
Please sign in to comment.
Something went wrong with that request. Please try again.