def get_detail_for_activity(request): form = request.form.clean() data = form_for_activity(form) result = task_service.get_state(form['act_id']) result.update(data) result['histories'] = task_service.get_activity_histories(form['act_id']) return JsonResponse(result)
def get_state(request): instance_id = request.GET.get('instance_id') try: instance = PipelineInstance.objects.get(instance_id=instance_id) if not instance.is_started: return JsonResponse({ "finish_time": None, "state": "CREATED", "retry": 0, "start_time": None, "children": {}}) except PipelineInstance.DoesNotExist: pass try: state = task_service.get_state(instance_id) return JsonResponse(state) except Exception as e: logger.exception(traceback.format_exc(e)) return JsonResponse(status=400, data={ 'message': 'invalid activity id.' })