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
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
def format_chronos_command(cmd): interpolated_command = parse_time_variables(cmd, datetime.datetime.now()) return interpolated_command
def format_tron_command(cmd: str) -> str: interpolated_command = parse_time_variables(cmd, date) return interpolated_command