def k8s_events_handle_build_job_statuses(self: 'celery_app.task', payload: Dict) -> None:
    """Project Plugin jobs statuses"""
    details = payload['details']
    app = details['labels']['app']
    job_uuid = details['labels']['job_uuid']
    job_name = details['labels']['job_name']
    project_name = details['labels'].get('project_name')
    logger.debug('handling events status for build jon %s %s', job_name, app)

    try:
        build_job = BuildJob.objects.get(uuid=job_uuid)
    except BuildJob.DoesNotExist:
        logger.info('Build job `%s` does not exist', job_name)
        return

    try:
        build_job.project
    except Project.DoesNotExist:
        logger.debug('`%s` does not exist anymore', project_name)

    # Set the new status
    try:
        set_node_scheduling(build_job, details['node_name'])
        build_job.set_status(status=payload['status'],
                             message=payload['message'],
                             traceback=payload.get('traceback'),
                             details=details)
    except IntegrityError:
        # Due to concurrency this could happen, we just retry it
        self.retry(countdown=Intervals.EXPERIMENTS_SCHEDULER)
def k8s_events_handle_build_job_statuses ( self : 'celery_app.task' , payload : Dict ) -> None : details = payload [ 'details' ] app = details [ 'labels' ] [ 'app' ] job_uuid = details [ 'labels' ] [ 'job_uuid' ] job_name = details [ 'labels' ] [ 'job_name' ] project_name = details [ 'labels' ] . get ( 'project_name' ) logger . debug ( 'handling events status for build jon %s %s' , job_name , app ) try : build_job = BuildJob . objects . get ( uuid = job_uuid ) except BuildJob . DoesNotExist : logger . info ( 'Build job `%s` does not exist' , job_name ) return try : build_job . project except Project . DoesNotExist : logger . debug ( '`%s` does not exist anymore' , project_name ) try : set_node_scheduling ( build_job , details [ 'node_name' ] ) build_job . set_status ( status = payload [ 'status' ] , message = payload [ 'message' ] , traceback = payload . get ( 'traceback' ) , details = details ) except IntegrityError : self . retry ( countdown = Intervals . EXPERIMENTS_SCHEDULER )
Project Plugin jobs statuses