示例#1
0
	def submit_result(self, job_key, status_code, result_content_type, result_data):

		fields = [('api_key', self.api_key), ('status_code', str(status_code)), ('content_type', result_content_type)]
		files = [('data', 'filename', result_data)]
		content_type, body = encode_multipart_formdata(fields, files)
		headers = {"Content-type": content_type, "Accept": "text/plain"}

		# #print "\n", body, "\n"

		conn = self.connection()
		conn.request('POST', '/jobs/%s/result'%(job_key), body, headers)
		resp = conn.getresponse()
		resp_data = resp.read()
		conn.close()
		if resp.status == 200:
			return resp_data
		else:
			print resp.status, resp.reason
			print resp_data
			return None
示例#2
0
	def submit_result(self, job_key, status_code, result_content_type, result_data):

		fields = [('api_key', self.api_key), ('status_code', str(status_code)), ('content_type', result_content_type)]
		files = [('data', 'filename', result_data)]
		content_type, body = encode_multipart_formdata(fields, files)
		headers = {"Content-type": content_type, "Accept": "text/plain"}

		# print "\n", body, "\n"

		conn = self.connection()
		conn.request('POST', '/jobs/%s/result'%(job_key), body, headers)
		resp = conn.getresponse()
		resp_data = resp.read()
		conn.close()
		if resp.status == 200:
			return resp_data
		else:
			print resp.status, resp.reason
			print resp_data
			return None
示例#3
0
	def submit_job(self, dmd_data, fpga_base):
		"""docstring for submit_job"""
	
		fields = [('api_key', self.api_key), ('base', fpga_base)]
		files = [('data', 'data.dmd', dmd_data)]
		content_type, body = encode_multipart_formdata(fields, files)
		headers = {"Content-type": content_type, "Accept": "text/plain"}
	
		# #print "\n", body, "\n"
	
		conn = self.connection()
		conn.request('POST', '/jobs/new', body, headers)
		resp = conn.getresponse()
		resp_data = resp.read()
		conn.close()
		if resp.status == 200:
			return resp_data
		else:
			print resp.status, resp.reason
			print resp_data
			return None
示例#4
0
	def submit_job(self, dmd_data, fpga_base):
		"""docstring for submit_job"""
	
		fields = [('api_key', self.api_key), ('base', fpga_base)]
		files = [('data', 'data.dmd', dmd_data)]
		content_type, body = encode_multipart_formdata(fields, files)
		headers = {"Content-type": content_type, "Accept": "text/plain"}
	
		# print "\n", body, "\n"
	
		conn = self.connection()
		conn.request('POST', '/jobs/new', body, headers)
		resp = conn.getresponse()
		resp_data = resp.read()
		conn.close()
		if resp.status == 200:
			return resp_data
		else:
			print resp.status, resp.reason
			print resp_data
			return None