summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrevor McKay <tmckay@redhat.com>2014-01-13 14:03:13 -0500
committerTrevor McKay <tmckay@redhat.com>2014-01-13 14:26:03 -0500
commitd664a41e0305dbc170dbd9d9dc929a7638f1e5d1 (patch)
treebac4e6b405426e21bfba9c3ba1d3f6a7175380af
parent828e2264df37d9bf54880ee03e5558d5f55340a4 (diff)
downloadpython-saharaclient-d664a41e0305dbc170dbd9d9dc929a7638f1e5d1.tar.gz
Allow passing extra args to JobExecutionsManager.create()
Java job types require additional parameters beyond cluster_id and configs. Add an optional dictionary and an update call to allow for additional key/value settings. Closes-Bug: #1268695 Change-Id: I995e648a939063170d1a2ac7040493351fb67f74
-rw-r--r--savannaclient/api/job_executions.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/savannaclient/api/job_executions.py b/savannaclient/api/job_executions.py
index 80436e6..b1a7065 100644
--- a/savannaclient/api/job_executions.py
+++ b/savannaclient/api/job_executions.py
@@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import copy
from savannaclient.api import base
@@ -32,13 +33,16 @@ class JobExecutionsManager(base.ResourceManager):
def delete(self, obj_id):
self._delete('/job-executions/%s' % obj_id)
- def create(self, job_id, cluster_id, input_id, output_id, configs):
+ def create(self, job_id, cluster_id, input_id, output_id, configs,
+ job_exec_data={}):
url = "/jobs/%s/execute" % job_id
- data = {
- "input_id": input_id,
- "output_id": output_id,
- "cluster_id": cluster_id,
- "job_configs": configs
- }
+ data = copy.copy(job_exec_data)
+ data.update(
+ {
+ "input_id": input_id,
+ "output_id": output_id,
+ "cluster_id": cluster_id,
+ "job_configs": configs
+ })
return self._create(url, data, 'job_execution')