src/dirbs/reports/csv_reports.py
def make_report_directory(ctx: callable, base_dir: str, run_id: int, conn: callable,
                          config: callable, class_run_id: int = None, **extra_options) -> str:
    """
    Make directory based on timestamp, data_id and class_run_id.

    Arguments:
        ctx: click cli context
        base_dir: path to the base directory
        run_id: run_id of the current job
        conn: DIRBS PostgreSQL connection object
        config: DIRBS config object
        class_run_id: run if of the classification job
        extra_options: extra options dir
    Returns:
        report_dir: Report directory path
    """
    assert run_id
    fn_components = ['report']

    # subcommand
    subcommand = ctx.command.name
    fn_components.append(subcommand)

    # timestamp
    run_id_start_time = metadata.job_start_time_by_run_id(conn, run_id)
    assert run_id_start_time
    fn_components.append(run_id_start_time.strftime('%Y%m%d_%H%M%S'))

    # run_id
    fn_components.append('run_id_{0:d}'.format(run_id))

    # class_run_id - to be computed if not provided and could be None in case of no classification jobs.
    if not class_run_id:
        cond_run_info = utils.most_recently_run_condition_info(conn, [c.label for c in config.conditions],
                                                               successful_only=True)
        if not cond_run_info:
            class_run_id = None
        else:
            class_run_id = max([v['run_id'] for k, v in cond_run_info.items()])

    if class_run_id:
        fn_components.append('class_id_{0:d}'.format(class_run_id))

    # data_id, month, year
    for k, v in sorted(extra_options.items()):
        assert v
        fn_components.append('{0}_{1}'.format(k, v))

    dir_name = '__'.join(fn_components)
    report_dir = os.path.join(base_dir, dir_name)
    os.makedirs(report_dir)
    return report_dir

    Make directory based on timestamp, data_id and class_run_id.

    Arguments:
        ctx: click cli context
        base_dir: path to the base directory
        run_id: run_id of the current job
        conn: DIRBS PostgreSQL connection object
        config: DIRBS config object
        class_run_id: run if of the classification job
        extra_options: extra options dir
    Returns:
        report_dir: Report directory path
    
Make directory based on timestamp, data_id and class_run_id.
Make directory based on timestamp data_id and class_run_id .
def make_report_directory(ctx: callable, base_dir: str, run_id: int, conn: callable,
                          config: callable, class_run_id: int = None, **extra_options) -> str:
    assert run_id
    fn_components = ['report']
    subcommand = ctx.command.name
    fn_components.append(subcommand)
    run_id_start_time = metadata.job_start_time_by_run_id(conn, run_id)
    assert run_id_start_time
    fn_components.append(run_id_start_time.strftime('%Y%m%d_%H%M%S'))
    fn_components.append('run_id_{0:d}'.format(run_id))
    if not class_run_id:
        cond_run_info = utils.most_recently_run_condition_info(conn, [c.label for c in config.conditions],
                                                               successful_only=True)
        if not cond_run_info:
            class_run_id = None
        else:
            class_run_id = max([v['run_id'] for k, v in cond_run_info.items()])
    if class_run_id:
        fn_components.append('class_id_{0:d}'.format(class_run_id))
    for k, v in sorted(extra_options.items()):
        assert v
        fn_components.append('{0}_{1}'.format(k, v))
    dir_name = '__'.join(fn_components)
    report_dir = os.path.join(base_dir, dir_name)
    os.makedirs(report_dir)
    return report_dir
def make_report_directory ( ctx : callable , base_dir : str , run_id : int , conn : callable , config : callable , class_run_id : int = None , ** extra_options ) -> str : assert run_id fn_components = [ 'report' ] subcommand = ctx . command . name fn_components . append ( subcommand ) run_id_start_time = metadata . job_start_time_by_run_id ( conn , run_id ) assert run_id_start_time fn_components . append ( run_id_start_time . strftime ( '%Y%m%d_%H%M%S' ) ) fn_components . append ( 'run_id_{0:d}' . format ( run_id ) ) if not class_run_id : cond_run_info = utils . most_recently_run_condition_info ( conn , [ c . label for c in config . conditions ] , successful_only = True ) if not cond_run_info : class_run_id = None else : class_run_id = max ( [ v [ 'run_id' ] for k , v in cond_run_info . items ( ) ] ) if class_run_id : fn_components . append ( 'class_id_{0:d}' . format ( class_run_id ) ) for k , v in sorted ( extra_options . items ( ) ) : assert v fn_components . append ( '{0}_{1}' . format ( k , v ) ) dir_name = '__' . join ( fn_components ) report_dir = os . path . join ( base_dir , dir_name ) os . makedirs ( report_dir ) return report_dir
Make directory based on timestamp, data_id and class_run_id.
Make directory based on timestamp data_id and class_run_id .
"""
    Make directory based on timestamp, data_id and class_run_id.

    Arguments:
        ctx: click cli context
        base_dir: path to the base directory
        run_id: run_id of the current job
        conn: DIRBS PostgreSQL connection object
        config: DIRBS config object
        class_run_id: run if of the classification job
        extra_options: extra options dir
    Returns:
        report_dir: Report directory path
    """ # subcommand # timestamp # run_id # class_run_id - to be computed if not provided and could be None in case of no classification jobs. # data_id, month, year
Report directory path
Report directory path
report_dir
ctx
callable
click cli context
click cli context
base_dir
str
path to the base directory
path to the base directory
run_id
int
run_id of the current job
run_id of the current job
conn
callable
DIRBS PostgreSQL connection object
DIRBS PostgreSQL connection object
config
callable
DIRBS config object
DIRBS config object
class_run_id
int
run if of the classification job
run if of the classification job
extra_options
extra options dir
extra options dir