def delete(ctx): """Delete a run. Uses /docs/core/cli/#caching Example: \b $ polyaxon ops delete \b $ polyaxon ops --uid=8aac02e3a62a4f0aaa257c59da5eab80 delete # project is cached \b $ polyaxon ops --project=cats-vs-dogs -uid 8aac02e3a62a4f0aaa257c59da5eab80 delete """ owner, project_name, run_uuid = get_project_run_or_local( ctx.obj.get("project"), ctx.obj.get("run_uuid"), is_cli=True, ) if not click.confirm("Are sure you want to delete run `{}`".format(run_uuid)): click.echo("Existing without deleting the run.") sys.exit(1) try: polyaxon_client = RunClient( owner=owner, project=project_name, run_uuid=run_uuid ) polyaxon_client.delete() # Purge caching RunManager.purge() except (ApiException, HTTPError) as e: handle_cli_error(e, message="Could not delete run `{}`.".format(run_uuid)) sys.exit(1) Printer.print_success("Run `{}` was delete successfully".format(run_uuid))
def purge(): """Purge the global config values.""" ClientConfigManager.purge() CliConfigManager.purge() AuthConfigManager.purge() ProjectManager.purge() RunManager.purge() Printer.print_success("Config was removed.")
def get_run_or_local(run_uuid=None, is_cli: bool = False): if run_uuid: return run_uuid if is_cli: return RunManager.get_config_or_raise().uuid run = RunManager.get_config() if run: return run.uuid return None
def delete(ctx): """Delete a run. Uses [Caching](/references/polyaxon-cli/#caching) Example: \b ```bash $ polyaxon runs delete ``` \b ```bash $ polyaxon runs --uid=8aac02e3a62a4f0aaa257c59da5eab80 delete # project is cached ``` \b ```bash $ polyaxon runs --project=cats-vs-dogs -id 8aac02e3a62a4f0aaa257c59da5eab80 delete ``` """ owner, project_name, run_uuid = get_project_run_or_local( ctx.obj.get("project"), ctx.obj.get("run_uuid")) if not click.confirm( "Are sure you want to delete run `{}`".format(run_uuid)): click.echo("Existing without deleting the run.") sys.exit(1) try: polyaxon_client = PolyaxonClient() polyaxon_client.runs_v1.delete_run(owner, project_name, run_uuid) # Purge caching RunManager.purge() except (ApiException, HTTPError) as e: handle_cli_error(e, message="Could not delete run `{}`.".format(run_uuid)) sys.exit(1) Printer.print_success("Run `{}` was delete successfully".format(run_uuid))
def get_run_or_local(run_uuid=None): return run_uuid or RunManager.get_config_or_raise().uuid
def test_default_props(self): assert RunManager.is_all_visibility() is True assert RunManager.IS_POLYAXON_DIR is True assert RunManager.CONFIG_FILE_NAME == ".run" assert RunManager.CONFIG == V1Run