Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if not quiet:
click.echo('done.', nl=True)
if parameters:
cls.print_pipeline_parameters_info(pipeline_model, pipeline_run_parameters)
else:
if not quiet:
click.echo('Evaluating estimated price...', nl=False)
run_price = Pipeline.get_estimated_price(pipeline_model.identifier,
pipeline_run_parameters.version,
instance_type,
instance_disk,
config_name=config,
price_type=price_type,
region_id=region_id)
click.echo('done.', nl=True)
price_table = prettytable.PrettyTable()
price_table.field_names = ["key", "value"]
price_table.align = "l"
price_table.set_style(12)
price_table.header = False
price_table.add_row(['Price per hour ({}, hdd {})'.format(run_price.instance_type,
run_price.instance_disk),
'{} $'.format(round(run_price.price_per_hour, 2))])
if run_price.minimum_time_price is not None and run_price.minimum_time_price > 0:
price_table.add_row(['Minimum price',
'{} $'.format(round(run_price.minimum_time_price, 2))])
if run_price.average_time_price is not None and run_price.average_time_price > 0:
price_table.add_row(['Average price',
'{} $'.format(round(run_price.average_time_price, 2))])
if run_price.maximum_time_price is not None and run_price.maximum_time_price > 0:
echo_title('Versions:', line=False)
if len(pipeline_model.versions) > 0:
versions_table = prettytable.PrettyTable()
versions_table.field_names = ["Name", "Created", "Draft"]
versions_table.align = "r"
for version_model in pipeline_model.versions:
versions_table.add_row([version_model.name, version_model.created_date, version_model.draft])
click.echo(versions_table)
click.echo()
else:
click.echo('No versions are configured for pipeline')
if storage_rules:
echo_title('Storage rules', line=False)
if len(pipeline_model.storage_rules) > 0:
storage_rules_table = prettytable.PrettyTable()
storage_rules_table.field_names = ["File mask", "Created", "Move to STS"]
storage_rules_table.align = "r"
for rule in pipeline_model.storage_rules:
storage_rules_table.add_row([rule.file_mask, rule.created_date, rule.move_to_sts])
click.echo(storage_rules_table)
click.echo()
else:
click.echo('No storage rules are configured for pipeline')
if permissions:
permissions_list = User.get_permissions(pipeline_model.identifier, 'pipeline')
echo_title('Permissions', line=False)
if len(permissions_list) > 0:
permissions_table = prettytable.PrettyTable()
permissions_table.field_names = ["SID", "Principal", "Allow", "Deny"]
permissions_table.align = "r"
def view_pipe(pipeline, versions, parameters, storage_rules, permissions):
try:
pipeline_model = Pipeline.get(pipeline, storage_rules, versions, parameters)
pipe_table = prettytable.PrettyTable()
pipe_table.field_names = ["key", "value"]
pipe_table.align = "l"
pipe_table.set_style(12)
pipe_table.header = False
pipe_table.add_row(['ID:', pipeline_model.identifier])
pipe_table.add_row(['Name:', pipeline_model.name])
pipe_table.add_row(['Latest version:', pipeline_model.current_version_name])
pipe_table.add_row(['Created:', pipeline_model.created_date])
pipe_table.add_row(['Source repo:', pipeline_model.repository])
pipe_table.add_row(['Description:', pipeline_model.description])
click.echo(pipe_table)
click.echo()
if parameters and pipeline_model.current_version is not None and pipeline_model.current_version.run_parameters is not None:
echo_title('Parameters:', line=False)
if len(pipeline_model.current_version.run_parameters.parameters) > 0:
sorted_columns = ['id'] + sorted(list(columns)) + ['created_in_cache',
'updated_in_cache']
sorted_columns_with_names = OrderedDict(
zip(sorted_columns, sorted_columns))
sorted_columns_with_names.update({'available_bandwidth': 'av/bw',
'created_in_cache': 'created',
'updated_in_cache': 'updated',
'latency_ns': 'lat'})
table = PrettyTable(sorted_columns_with_names.values(),
border=border,
sortby='id',
vrules=prettytable.FRAME,
hrules=prettytable.FRAME)
convert_timefied_to_human(raw)
for d in raw:
table.add_row([d[x] for x in sorted_columns_with_names.keys()])
print(table)
def print_path(flow, border):
path = flow['flowpath']['path']
keys = ['switch_id', 'port_no', 'segment_latency', 'seq_id']
table = PrettyTable(keys, border=border, vrules=prettytable.NONE,
hrules=prettytable.HEADER,
padding_width=0)
for p in path:
table.add_row([p.get(x, None) for x in keys])
return table
def print_path(flow, border):
path = flow['flowpath']['path']
keys = ['switch_id', 'port_no', 'segment_latency', 'seq_id']
table = PrettyTable(keys, border=border, vrules=prettytable.NONE,
hrules=prettytable.HEADER,
padding_width=0)
for p in path:
table.add_row([p.get(x, None) for x in keys])
return table