def info(counter): """ Show execution info. """ execution = get_project(require=True).get_execution_from_counter( counter=counter, detail=True) data = dict((humanize_identifier(key), str(value)) for (key, value) in execution.items() if key not in ignored_keys) data['project name'] = execution['project']['name'] data['environment name'] = execution['environment']['name'] print_table(data) print() print_table( { input['name']: '; '.join(input['urls']) for input in execution.get('inputs', ()) }, headers=('input', 'URLs'), ) print() print_table( execution.get('parameters', {}), headers=('parameter', 'value'), ) print()
def info(counter: str) -> None: """ Show execution info. """ project = get_project(require=True) assert project execution = project.get_execution_from_counter( counter=counter, params={ 'exclude': 'metadata,events', }, ) if settings.output_format == 'json': return print_json(execution) data = {humanize_identifier(key): str(value) for (key, value) in execution.items() if key not in ignored_keys} data['project name'] = execution['project']['name'] data['environment name'] = execution['environment']['name'] print_table(data) print() print_table( {input['name']: '; '.join(input['urls']) for input in execution.get('inputs', ())}, headers=('input', 'URLs'), ) print() print_table( execution.get('parameters', {}), headers=('parameter', 'value'), ) print()
def convert_input_to_option(self, input): """ Convert an Input into a click Option. :type input: valohai_yaml.objs.input.Input :rtype: click.Option """ assert isinstance(input, Input) option = click.Option( param_decls=[ '--%s' % input.name.replace('_', '-'), ], required=(input.default is None and not input.optional), default=input.default, metavar='URL', help='Input "%s"' % humanize_identifier(input.name), ) option.name = '^%s' % input.name # Caretize so we can pick these out of kwargs easily return option
def test_humanize_identifier(): assert humanize_identifier('_____Foo-Bar_______') == 'Foo Bar'