From 8b705687019f4c438500057ac2627ab532f084c2 Mon Sep 17 00:00:00 2001 From: Trevor McKay Date: Tue, 14 Jan 2014 13:27:49 -0500 Subject: [PATCH] JobExecutionsManager.create() should handle input_id/output_id == None Input and output ids are not part of the Java workflow JSON schema. Including them, even set to None, causes an error. In order to maintain backward compatibility, leave input_id and output_id as required parameters but do not add them to the job exec data if they are None. Closes-Bug: #1268695 Change-Id: I8df8cb86094f5d67ca16de7d6dd253af142eca25 --- savannaclient/api/job_executions.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/savannaclient/api/job_executions.py b/savannaclient/api/job_executions.py index b1a70653..8fdf43a4 100644 --- a/savannaclient/api/job_executions.py +++ b/savannaclient/api/job_executions.py @@ -37,10 +37,18 @@ class JobExecutionsManager(base.ResourceManager): job_exec_data={}): url = "/jobs/%s/execute" % job_id data = copy.copy(job_exec_data) + + # Leave these out if they are null. For Java job types they + # are not part of the schema + io_ids = (("input_id", input_id), + ("output_id", output_id)) + for key, value in io_ids: + if value is not None: + data.update({key: value}) + + # These are always required data.update( { - "input_id": input_id, - "output_id": output_id, "cluster_id": cluster_id, "job_configs": configs })