Example #1
0
def get_jobid(jobid):
	try:
		# Return details for specified job ID
		res = myDb.get_job(jobid)

		# check results returned
		if res:
			encoded = jsonpickle.encode(res)
			response.content_type = "application/json"
			return encoded
		else:
			response.status = "404 - No job found with this ID."
			return
	except Exception as e:
		raise Exception('Exception encountered: ' + str(e))
		return None
Example #2
0
def update_job_status(jobid):
	job_status = request.forms.status
	job_client = None
	if hasattr(request.forms, 'client') :
		job_client = request.forms.client
	if job_status:
		job = myDb.get_job(jobid)
		if job is not None:
			print "Setting ", job.id, " to ", job_status
			myDb.put_job_status(job.id, job_status, job_client)
		else:
			response.status = "404 - No job found with this ID."
			return
	else:
		response.status = "400 - Required fields missing."
		return
Example #3
0
 def cancel_package_instance(self, job_id):  # FIXME: rename...
     # cancels a specific job/package instance
     try:
         if not job_id:
             response.status = "400 - Required fields missing."
             return
         else:
             job_to_cancel = myDb.get_job(job_id)
             if not job_to_cancel:
                 response.status = "404 - no job matching id"
             else:
                 self.process_cancel(job_to_cancel)
     except Exception as e:
         raise Exception("Error parsing job information: " + str(e))
         response.status = "500 - Error parsing job information"
         return
     return