def delete_all()

in src/smexperiments/trial.py [0:0]


    def delete_all(self, action):
        """
        Force to delete the trial and associated trial components under.

        Args:
            action (str): pass in string '--force' to confirm delete the trial and all associated trial components.
        """
        if action != "--force":
            raise ValueError(
                "Must confirm with string '--force' in order to delete the trial and " "associated trial components."
            )

        delete_attempt_count = 0
        last_exception = None
        while True:
            if delete_attempt_count == self.MAX_DELETE_ALL_ATTEMPTS:
                raise Exception("Failed to delete, please try again.") from last_exception
            try:
                for trial_component_summary in self.list_trial_components():
                    tc = trial_component.TrialComponent.load(
                        sagemaker_boto_client=self.sagemaker_boto_client,
                        trial_component_name=trial_component_summary.trial_component_name,
                    )
                    tc.delete(force_disassociate=True)
                    # to prevent throttling
                    time.sleep(1.2)
                self.delete()
                break
            except Exception as ex:
                last_exception = ex
            finally:
                delete_attempt_count = delete_attempt_count + 1