Ejemplo n.º 1
0
    def purge_runs(self, **opts):
        self._sync_runs_meta()
        args = click_util.Args(**opts)
        args.archive = self._deleted_runs_dir
        preview = (
            "WARNING: You are about to permanently delete "
            "the following runs on %s:" % self.name
        )
        confirm = "Permanently delete these runs?"
        no_runs_help = "Nothing to purge."

        def purge_f(selected):
            self._purge_runs(selected)
            self._new_meta_id()
            self._sync_runs_meta(force=True)

        try:
            runs_impl.runs_op(
                args,
                None,
                False,
                preview,
                confirm,
                no_runs_help,
                purge_f,
                confirm_default=False,
            )
        except SystemExit as e:
            self._reraise_system_exit(e, deleted=True)
Ejemplo n.º 2
0
    def restore_runs(self, **opts):
        self._sync_runs_meta()
        args = click_util.Args(**opts)
        args.archive = self._deleted_runs_dir
        preview = "You are about to restore the following runs on %s:" % self.name
        confirm = "Restore these runs?"
        no_runs_help = "Nothing to restore."

        def restore_f(selected):
            self._restore_runs(selected)
            self._new_meta_id()
            self._sync_runs_meta(force=True)

        try:
            runs_impl.runs_op(
                args,
                None,
                False,
                preview,
                confirm,
                no_runs_help,
                restore_f,
                confirm_default=True,
            )
        except SystemExit as e:
            self._reraise_system_exit(e, deleted=True)
Ejemplo n.º 3
0
 def delete_runs(self, **opts):
     self._verify_creds_and_region()
     self._sync_runs_meta()
     args = click_util.Args(**opts)
     args.archive = self._runs_dir
     if args.permanent:
         preview = (
             "WARNING: You are about to permanently delete "
             "the following runs on %s:" % self.name)
         confirm = "Permanently delete these runs?"
     else:
         preview = (
             "You are about to delete the following runs on %s:"
             % self.name)
         confirm = "Delete these runs?"
     no_runs_help = "Nothing to delete."
     def delete_f(selected):
         self._delete_runs(selected, args.permanent)
         self._new_meta_id()
         self._sync_runs_meta(force=True)
     try:
         runs_impl.runs_op(
             args, None, False, preview, confirm, no_runs_help,
             delete_f, confirm_default=not args.permanent)
     except SystemExit as e:
         self._reraise_system_exit(e)
Ejemplo n.º 4
0
    def delete_runs(self, **opts):
        if not self._deleted_runs_dir and not opts.get("permanent"):
            raise remotelib.OperationNotSupported(
                "remote '%s' does not support non permanent deletes\n"
                "Use the '--permanent' with this command and try again." % self.name
            )
        args = click_util.Args(archive=self._runs_dir, remote=None, **opts)
        self._sync_runs_meta()
        if args.permanent:
            preview = cmd_impl_support.format_warn(
                "WARNING: You are about to permanently delete "
                "the following runs on %s:" % self.name
            )
            confirm = "Permanently delete these runs?"
        else:
            preview = "You are about to delete the following runs on %s:" % self.name
            confirm = "Delete these runs?"
        no_runs_help = "Nothing to delete."

        def delete_f(selected):
            self._delete_runs(selected, args.permanent)
            self._sync_runs_meta(force=True)

        try:
            runs_impl.runs_op(
                args,
                None,
                preview,
                confirm,
                no_runs_help,
                delete_f,
                confirm_default=not args.permanent,
            )
        except SystemExit as e:
            raise self._fix_system_exit_msg_for_remote(e, ["runs rm", "runs delete"])
Ejemplo n.º 5
0
    def purge_runs(self, **opts):
        if not self._deleted_runs_dir:
            raise remotelib.OperationNotSupported()
        self._sync_runs_meta()
        args = click_util.Args(archive=self._deleted_runs_dir, remote=None, **opts)
        preview = (
            "WARNING: You are about to permanently delete "
            "the following runs on %s:" % self.name
        )
        confirm = "Permanently delete these runs?"
        no_runs_help = "Nothing to purge."

        def purge_f(selected):
            self._purge_runs(selected)
            self._sync_runs_meta(force=True)

        try:
            runs_impl.runs_op(
                args,
                None,
                preview,
                confirm,
                no_runs_help,
                purge_f,
                confirm_default=False,
            )
        except SystemExit as e:
            self._fix_system_exit_msg_for_remote(e, ["runs purge"])
Ejemplo n.º 6
0
    def restore_runs(self, **opts):
        if not self._deleted_runs_dir:
            raise remotelib.OperationNotSupported()
        self._sync_runs_meta()
        args = click_util.Args(archive=self._deleted_runs_dir, remote=None, **opts)
        preview = "You are about to restore the following runs on %s:" % self.name
        confirm = "Restore these runs?"
        no_runs_help = "Nothing to restore."

        def restore_f(selected):
            self._restore_runs(selected)
            self._sync_runs_meta(force=True)

        try:
            runs_impl.runs_op(
                args,
                None,
                preview,
                confirm,
                no_runs_help,
                restore_f,
                confirm_default=True,
            )
        except SystemExit as e:
            self._fix_system_exit_msg_for_remote(e, ["runs restore"])