def get(self, participant_id, job_id): job = _get_job(job_id) workflow = job.workflow project_config = workflow.project.get_config() party = project_config.participants[participant_id] client = RpcClient(project_config, party) resp = client.get_job_metrics(job.name) if resp.status.code != common_pb2.STATUS_SUCCESS: raise InternalException(resp.status.msg) metrics = json.loads(resp.metrics) # Metrics is a list of dict. Each dict can be rendered by frontend with # mpld3.draw_figure('figure1', json) return {'data': metrics}
def get(self, workflow_id, participant_id, job_name): workflow = Workflow.query.filter_by(id=workflow_id).first() if workflow is None: raise NotFoundException() project_config = workflow.project.get_config() party = project_config.participants[participant_id] client = RpcClient(project_config, party) resp = client.get_job_metrics(workflow.name, job_name) if resp.status.code != common_pb2.STATUS_SUCCESS: raise InternalException(resp.status.msg) metrics = json.loads(resp.metrics) # Metrics is a list of dict. Each dict can be rendered by frontend with # mpld3.draw_figure('figure1', json) return {'data': metrics}