class_docstr: An execution of a data-science workflow with an experiment.
  
  Consists of a list of trial component objects, which document individual
  activities within the workflow.
  
  Attributes:
      trial_name (str): The name of the trial.
      experiment_name (str): The name of the trial's experiment.
      display_name (str): The name of the trial that will appear in UI,
          such as SageMaker Studio.
      tags (List[Dict[str, str]]): A list of tags to associate with the trial.
class_docstr_tok: ["An","execution","of","a","data-science","workflow","with","an","experiment",".","Consists","of","a","list","of","trial","component","objects",",","which","document","individual","activities","within","the","workflow",".","Attributes",":","trial_name","(","str",")",":","The","name","of","the","trial",".","experiment_name","(","str",")",":","The","name","of","the","trial","'s","experiment",".","display_name","(","str",")",":","The","name","of","the","trial","that","will","appear","in","UI",",","such","as","SageMaker","Studio",".","tags","(","List","[","Dict","[","str",",","str","]","]",")",":","A","list","of","tags","to","associate","with","the","trial","."]
docstr: Load a trial by name and create a new one if it does not exist.
  
  Args:
      experiment_name: (str): Name of the experiment to create this trial in.
      trial_name: (str): Name of the Trial.
      display_name (str): Name of the trial that will appear in UI,
          such as SageMaker Studio (default: None). This is used only when the given
          `trial_name` does not exist and a new trial has to be created.
      tags (Optional[Tags]): A list of tags to associate with the trial (default: None).
          This is used only when the given `trial_name` does not exist and
          a new trial has to be created.
      sagemaker_session (sagemaker.session.Session): Session object which
          manages interactions with Amazon SageMaker APIs and any other
          AWS services needed. If not specified, one is created using the
          default AWS configuration chain.
  
  Returns:
      experiments.trial._Trial: A SageMaker `_Trial` object
docstr_tok: ["Load","a","trial","by","name","and","create","a","new","one","if","it","does","not","exist",".","Args",":","experiment_name",":","(","str",")",":","Name","of","the","experiment","to","create","this","trial","in",".","trial_name",":","(","str",")",":","Name","of","the","Trial",".","display_name","(","str",")",":","Name","of","the","trial","that","will","appear","in","UI",",","such","as","SageMaker","Studio","(","default",":","None",")",".","This","is","used","only","when","the","given","`","trial_name","`","does","not","exist","and","a","new","trial","has","to","be","created",".","tags","(","Optional","[","Tags","]",")",":","A","list","of","tags","to","associate","with","the","trial","(","default",":","None",")",".","This","is","used","only","when","the","given","`","trial_name","`","does","not","exist","and","a","new","trial","has","to","be","created",".","sagemaker_session","(","sagemaker.session.Session",")",":","Session","object","which","manages","interactions","with","Amazon","SageMaker","APIs","and","any","other","AWS","services","needed",".","If","not","specified",",","one","is","created","using","the","default","AWS","configuration","chain",".","Returns",":","experiments.trial._Trial",":","A","SageMaker","`","_Trial","`","object"]
code: def _load_or_create(
      cls,
      experiment_name,
      trial_name,
      display_name=None,
      tags=None,
      sagemaker_session=None,
  ):
      """Load a trial by name and create a new one if it does not exist.
  
      Args:
          experiment_name: (str): Name of the experiment to create this trial in.
          trial_name: (str): Name of the Trial.
          display_name (str): Name of the trial that will appear in UI,
              such as SageMaker Studio (default: None). This is used only when the given
              `trial_name` does not exist and a new trial has to be created.
          tags (Optional[Tags]): A list of tags to associate with the trial (default: None).
              This is used only when the given `trial_name` does not exist and
              a new trial has to be created.
          sagemaker_session (sagemaker.session.Session): Session object which
              manages interactions with Amazon SageMaker APIs and any other
              AWS services needed. If not specified, one is created using the
              default AWS configuration chain.
  
      Returns:
          experiments.trial._Trial: A SageMaker `_Trial` object
      """
      try:
          trial = _Trial.create(
              experiment_name=experiment_name,
              trial_name=trial_name,
              display_name=display_name,
              tags=format_tags(tags),
              sagemaker_session=sagemaker_session,
          )
      except ClientError as ce:
          error_code = ce.response["Error"]["Code"]
          error_message = ce.response["Error"]["Message"]
          if not (
              error_code == "ValidationException"
              and "already exists" in error_message
          ):
              raise ce
          # already exists
          trial = _Trial.load(trial_name, sagemaker_session)
          if (
              trial.experiment_name != experiment_name
          ):  # pylint: disable=no-member
              raise ValueError(
                  "The given experiment_name {} ".format(
                      experiment_name
                  )
                  + "does not match that in the loaded trial {}".format(
                      trial.experiment_name  # pylint: disable=no-member
                  )
              )
      return trial
  
file_path: sagemaker-python-sdk/src/sagemaker/experiments/trial.py
imports: from __future__ import absolute_import
  from botocore.exceptions import ClientError
  from sagemaker.apiutils import _base_types
  from sagemaker.experiments import _api_types
  from sagemaker.experiments.trial_component import _TrialComponent
  from sagemaker.utils import format_tags
label_desc: Use image node_id 10 for calling the _Trial obj's underlying member method code with example usage: obj._load_or_create(cls, experiment_name, trial_name, display_name, tags, sagemaker_session) and returns: trial