def _metadata_response(id, job): return JobMetadataResponse(id=id, status=job_statuses.dsub_to_api(job), submission=job['create-time'], name=job['job-name'], start=job.get('start-time'), end=job['end-time'], inputs=job['inputs'], outputs=job['outputs'], labels=labels.dsub_to_api(job), failures=failures.get_failures(job), extensions=extensions.get_extensions(job))
def _query_jobs_result(job, project_id=None): return QueryJobsResult( id=job_ids.dsub_to_api(project_id, job['job-id'], job.get('task-id')), name=job['job-name'], status=job_statuses.dsub_to_api(job), # The LocalJobProvider returns create-time with millisecond granularity. # For consistency with the GoogleJobProvider, truncate to second # granularity. submission=job['create-time'].replace(microsecond=0), start=job.get('start-time'), end=job['end-time'], labels=labels.dsub_to_api(job), extensions=extensions.get_extensions(job))