src/dirbs/metadata.py
def job_start_time_by_run_id(conn, run_id, successful_only=False):
    """
    Get the job start time for a job corresponding to the passed run_id.

    Arguments:
        conn: dirbs db connection object
        run_id: id of the job to filter on
        successful_only: bool to filter successful jobs only, default is False
    Returns:
        job start time if exists else none
    """
    with conn.cursor() as cursor:
        if successful_only:
            status_filter_sql = sql.SQL("status = \'success\'")
        else:
            status_filter_sql = sql.SQL('TRUE')

        cursor.execute(sql.SQL("""SELECT start_time
                                    FROM job_metadata
                                   WHERE run_id = %s
                                     AND {status_filter_sql}
                                ORDER BY start_time DESC""").format(status_filter_sql=status_filter_sql),
                       [run_id])
        jt = cursor.fetchone()
        return jt.start_time if jt else None

    Get the job start time for a job corresponding to the passed run_id.

    Arguments:
        conn: dirbs db connection object
        run_id: id of the job to filter on
        successful_only: bool to filter successful jobs only, default is False
    Returns:
        job start time if exists else none
    
Get the job start time for a job corresponding to the passed run_id.
Get the job start time for a job corresponding to the passed run_id .
def job_start_time_by_run_id(conn, run_id, successful_only=False):
    with conn.cursor() as cursor:
        if successful_only:
            status_filter_sql = sql.SQL("status = \'success\'")
        else:
            status_filter_sql = sql.SQL('TRUE')
        cursor.execute(sql.SQL("""SELECT start_time
                                    FROM job_metadata
                                   WHERE run_id = %s
                                     AND {status_filter_sql}
                                ORDER BY start_time DESC""").format(status_filter_sql=status_filter_sql),
                       [run_id])
        jt = cursor.fetchone()
        return jt.start_time if jt else None
def job_start_time_by_run_id ( conn , run_id , successful_only = False ) : with conn . cursor ( ) as cursor : if successful_only : status_filter_sql = sql . SQL ( "status = \'success\'" ) else : status_filter_sql = sql . SQL ( 'TRUE' ) cursor . execute ( sql . SQL ( """SELECT start_time
                                    FROM job_metadata
                                   WHERE run_id = %s
                                     AND {status_filter_sql}
                                ORDER BY start_time DESC""" ) . format ( status_filter_sql = status_filter_sql ) , [ run_id ] ) jt = cursor . fetchone ( ) return jt . start_time if jt else None
Get the job start time for a job corresponding to the passed run_id.
Get the job start time for a job corresponding to the passed run_id .
"""
    Get the job start time for a job corresponding to the passed run_id.

    Arguments:
        conn: dirbs db connection object
        run_id: id of the job to filter on
        successful_only: bool to filter successful jobs only, default is False
    Returns:
        job start time if exists else none
    """
job start time if exists else none
job start time if exists else none
conn
dirbs db connection object
dirbs db connection object
run_id
id of the job to filter on
id of the job to filter on
successful_only
bool to filter successful jobs only, default is False
bool to filter successful jobs only default is False