def send_worker_command(request): if request.POST: command = request.POST['command'] worker_id = request.POST['worker_id'] Master.send_master(command, worker_id) return HttpResponse('Command sent to worker') return HttpResponse('Missing command and worker to send, use POST')
def send_session_detail_command(request): if request.POST: command = request.POST['command'] session_detail_id = request.POST['session_detail_id'] session_detail = SessionDetail.objects.get(pk=int(session_detail_id)) if session_detail.assigned_worker is None: return HttpResponse('Session detail has no assigned worker') worker_id = str(session_detail.assigned_worker.id) Master.send_master(command, worker_id) return HttpResponse('Command sent to worker') return HttpResponse('Missing command and worker to send, use POST')
def send_master_command(request): if request.POST: command = request.POST['command'] Master.send_master(command) return HttpResponse('Command sent to master') return HttpResponse('Missing command to send, use POST')
def workers_info(request): Master.send_master("info") return HttpResponse('All workers asked to reregister')