def post(self, request, version_id): """ Run a workflow on the cluster """ notification_method = None notification_url = None notification = request.POST.get("Notification", None) if notification: notification_method = notification.split()[0] notification_url = notification.split()[1] notification_email = request.POST.get("NotificationEmail", None) job_name = request.POST["JobName"] description = request.POST["Description"] stages = json.loads(request.POST["Stages"]) files = {} for k, v in request.FILES.iteritems(): if k not in files: files[k] = [] for f in request.FILES.getlist(k): files[k].append(f) jms = JobManager(user=request.user) version = jms.GetWorkflowVersionByID(version_id) job = jms.CreateJob(job_name, description, WorkflowVersion=version, JobTypeID=3 , NotificationMethod=notification_method, NotificationURL=notification_url, NotificationEmail=notification_email) jms.RunWorkflowJob(job, stages, files) return Response(job.JobID)