Exemplo n.º 1
0
	'gate_cir'		: shape_gating,
	'gate_poly'		: shape_gating,
	'gate_bool'		: shape_gating,
	'change_axis'	: axis_change,
	'dot_plot'		: change_plot,
	'contour_plot'	: change_plot,
	'gate_quad'		: quadrant_gate,
	'gate_norm'		: data_gate,
	'gate_kmeans'	: data_gate
}

# Check task queue until 'kill' command is received.
alive = True
while alive:
	# Lease a command.
	try:
		task = Queue.lease('jobs', 30)
	except Exception, e:
		print e
	# If there are tasks in queue extract id and commands, else restart loop and check queue again.
	if task is not None:
		task_id = task[0]
		commands = task[1]
	else:
		time.sleep(0.9)
		continue
	functionToCall = AVAILABLE_TASKS[commands[0]]
	alive = functionToCall(commands)
	# Delete any processed tasks from queue.
	if task_id is not None:
		Queue.delete('jobs', task_id)