예제 #1
0
def modify_command_for_date(chronos_job, date, verbose):
    """
    Given a chronos job config, return a cloned job config where the command
    has been modified to reflect what it would have run as on
    a given date.

    :param chronos_job: a chronos job dictionary, as created by
        ``chronos_tools.create_complete_config``
    :param date: a ``datetime.datetime`` object.
    :returns chronos_job: a chronos_job dict with the command modified to
        interpolate in the context of the date provided.
    """
    current_command = chronos_job['command']
    if current_command is not None:
        chronos_job['command'] = chronos_tools.parse_time_variables(
            command=current_command,
            parse_time=date,
        )
    else:
        if verbose:
            job_name = ".".join(
                chronos_tools.decompose_job_id(chronos_job['name']))
            paasta_print(
                f'command in job {job_name} is empty - skipping formatting and depending on command in image'
            )
    return chronos_job
예제 #2
0
def modify_command_for_date(chronos_job, date):
    """
    Given a chronos job config, return a cloned job config where the command
    has been modified to reflect what it would have run as on
    a given date.

    :param chronos_job: a chronos job dictionary, as created by
    ``chronos_tools.create_complete_config``
    :param date: a ``datetime.datetime`` object.
    :returns chronos_job: a chronos_job dict with the command modified to
    interpolate in the context of the date provided.
    """
    current_command = chronos_job['command']
    chronos_job['command'] = chronos_tools.parse_time_variables(current_command, date)
    return chronos_job
예제 #3
0
파일: local_run.py 프로젝트: tiras-j/paasta
 def format_chronos_command(cmd):
     interpolated_command = parse_time_variables(cmd, datetime.datetime.now())
     return interpolated_command
예제 #4
0
 def format_chronos_command(cmd):
     interpolated_command = parse_time_variables(cmd, datetime.datetime.now())
     return interpolated_command
예제 #5
0
 def format_tron_command(cmd: str) -> str:
     interpolated_command = parse_time_variables(cmd, date)
     return interpolated_command