Пример #1
0
 def post(self, request, version_id):
     """
     Run a tool on the cluster
     """
     try:
         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.get("JobName", "")
         description = request.POST.get("Description", "")
         parameters = json.loads(request.POST["Parameters"])
         #settings = json.loads(request.POST["Settings"])
         
         
         files = []
         for k, v in request.FILES.iteritems():
             for pf in request.FILES.getlist(k):
                 files.append(pf)
         
         jms = JobManager(user=request.user)
         
         version = jms.GetToolVersionByID(int(version_id))
         
         job = jms.CreateJob(job_name, description, ToolVersion=version, JobTypeID=2, 
             NotificationMethod=notification_method, NotificationURL=notification_url,
             NotificationEmail=notification_email)
         
         jobstage = jms.RunToolJob(job, parameters, files)
         
         return Response(jobstage.Job.JobID)
     except Exception, ex:
         with open("/tmp/create_tool_job.txt", "w") as f:
             print >> f, traceback.format_exc()
         
         return Response(str(ex), status=500)
Пример #2
0
 def post(self, request):
     """
     Submit a custom script to be run on the cluster
     """
     job_name = request.POST.get("JobName", "")
     description = request.POST.get("Description", "")
     commands = request.POST["Commands"]
     settings = json.loads(request.POST["Settings"])
     
     files = request.FILES.getlist("files")
         
     notification_method = request.POST.get("NotificationMethod", "GET")
     notification_url = request.POST.get("NotificationURL", None)
     notification_email = request.POST.get("NotificationEmail", None)
     
     jms = JobManager(user=request.user)
     
     job = jms.CreateJob(job_name, description, 1, NotificationMethod=notification_method, 
         NotificationURL=notification_url, NotificationEmail=notification_email)
     
     jobstage = jms.RunCustomJob(job, commands, settings, files)
     
     return Response(jobstage.Job.JobID)
Пример #3
0
 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)