class_docstr: Handle end-to-end training and deployment of XGBoost booster training.
  
  It can also handle training using customer provided XGBoost entry point script.
class_docstr_tok: ["Handle","end-to-end","training","and","deployment","of","XGBoost","booster","training",".","It","can","also","handle","training","using","customer","provided","XGBoost","entry","point","script","."]
docstr: Attach to an existing training job.
  
  Create an Estimator bound to an existing training job, each subclass
  is responsible to implement
  ``_prepare_init_params_from_job_description()`` as this method delegates
  the actual conversion of a training job description to the arguments
  that the class constructor expects. After attaching, if the training job
  has a Complete status, it can be ``deploy()`` ed to create a SageMaker
  Endpoint and return a ``Predictor``.
  
  If the training job is in progress, attach will block and display log
  messages from the training job, until the training job completes.
  
  Examples:
      >>> my_estimator.fit(wait=False)
      >>> training_job_name = my_estimator.latest_training_job.name
      Later on:
      >>> attached_estimator = Estimator.attach(training_job_name)
      >>> attached_estimator.deploy()
  
  Args:
      training_job_name (str): The name of the training job to attach to.
      sagemaker_session (sagemaker.session.Session): Session object which
          manages interactions with Amazon SageMaker APIs and any other
          AWS services needed. If not specified, the estimator creates one
          using the default AWS configuration chain.
      model_channel_name (str): Name of the channel where pre-trained
          model data will be downloaded (default: 'model'). If no channel
          with the same name exists in the training job, this option will
          be ignored.
  
  Returns:
      Instance of the calling ``Estimator`` Class with the attached
      training job.
docstr_tok: ["Attach","to","an","existing","training","job",".","Create","an","Estimator","bound","to","an","existing","training","job",",","each","subclass","is","responsible","to","implement","``","_prepare_init_params_from_job_description","(",")","``","as","this","method","delegates","the","actual","conversion","of","a","training","job","description","to","the","arguments","that","the","class","constructor","expects",".","After","attaching",",","if","the","training","job","has","a","Complete","status",",","it","can","be","``","deploy","(",")","``","ed","to","create","a","SageMaker","Endpoint","and","return","a","``","Predictor","``",".","If","the","training","job","is","in","progress",",","attach","will","block","and","display","log","messages","from","the","training","job",",","until","the","training","job","completes",".","Examples",":",">",">",">","my_estimator.fit","(","wait=False",")",">",">",">","training_job_name","=","my_estimator.latest_training_job.name","Later","on",":",">",">",">","attached_estimator","=","Estimator.attach","(","training_job_name",")",">",">",">","attached_estimator.deploy","(",")","Args",":","training_job_name","(","str",")",":","The","name","of","the","training","job","to","attach","to",".","sagemaker_session","(","sagemaker.session.Session",")",":","Session","object","which","manages","interactions","with","Amazon","SageMaker","APIs","and","any","other","AWS","services","needed",".","If","not","specified",",","the","estimator","creates","one","using","the","default","AWS","configuration","chain",".","model_channel_name","(","str",")",":","Name","of","the","channel","where","pre-trained","model","data","will","be","downloaded","(","default",":","'model","'",")",".","If","no","channel","with","the","same","name","exists","in","the","training","job",",","this","option","will","be","ignored",".","Returns",":","Instance","of","the","calling","``","Estimator","``","Class","with","the","attached","training","job","."]
code: def attach(
      cls,
      training_job_name,
      sagemaker_session=None,
      model_channel_name="model",
  ):
      """Attach to an existing training job.
  
      Create an Estimator bound to an existing training job, each subclass
      is responsible to implement
      ``_prepare_init_params_from_job_description()`` as this method delegates
      the actual conversion of a training job description to the arguments
      that the class constructor expects. After attaching, if the training job
      has a Complete status, it can be ``deploy()`` ed to create a SageMaker
      Endpoint and return a ``Predictor``.
  
      If the training job is in progress, attach will block and display log
      messages from the training job, until the training job completes.
  
      Examples:
          >>> my_estimator.fit(wait=False)
          >>> training_job_name = my_estimator.latest_training_job.name
          Later on:
          >>> attached_estimator = Estimator.attach(training_job_name)
          >>> attached_estimator.deploy()
  
      Args:
          training_job_name (str): The name of the training job to attach to.
          sagemaker_session (sagemaker.session.Session): Session object which
              manages interactions with Amazon SageMaker APIs and any other
              AWS services needed. If not specified, the estimator creates one
              using the default AWS configuration chain.
          model_channel_name (str): Name of the channel where pre-trained
              model data will be downloaded (default: 'model'). If no channel
              with the same name exists in the training job, this option will
              be ignored.
  
      Returns:
          Instance of the calling ``Estimator`` Class with the attached
          training job.
      """
      sagemaker_session = sagemaker_session or Session()
  
      job_details = (
          sagemaker_session.sagemaker_client.describe_training_job(
              TrainingJobName=training_job_name
          )
      )
      init_params = cls._prepare_init_params_from_job_description(
          job_details, model_channel_name
      )
      tags = sagemaker_session.sagemaker_client.list_tags(
          ResourceArn=job_details["TrainingJobArn"]
      )["Tags"]
      init_params.update(tags=tags)
  
      estimator = cls(
          sagemaker_session=sagemaker_session, **init_params
      )
      estimator.latest_training_job = _TrainingJob(
          sagemaker_session=sagemaker_session,
          job_name=training_job_name,
      )
      estimator._current_job_name = estimator.latest_training_job.name
      estimator.latest_training_job.wait()
  
      # pylint gets confused thinking that estimator is an EstimatorBase instance, but it actually
      # is a Framework or any of its derived classes. We can safely ignore the no-member errors.
      estimator.uploaded_code = UploadedCode(
          estimator.source_dir,
          estimator.entry_point,  # pylint: disable=no-member
      )
      return estimator
  
file_path: sagemaker-python-sdk/src/sagemaker/xgboost/estimator.py
imports: from __future__ import absolute_import
  import logging
  from typing import Union, Optional, Dict
  from sagemaker import image_uris
  from sagemaker.deprecations import renamed_kwargs
  from sagemaker.estimator import Framework, _TrainingJob
  from sagemaker.fw_utils import framework_name_from_image, framework_version_from_tag, UploadedCode
  from sagemaker.session import Session
  from sagemaker.vpc_utils import VPC_CONFIG_DEFAULT
  from sagemaker.workflow.entities import PipelineVariable
  from sagemaker.xgboost import defaults
  from sagemaker.xgboost.model import XGBoostModel
  from sagemaker.xgboost.utils import validate_py_version, validate_framework_version
label_desc: Use image node_id 3 for calling the XGBoost obj's underlying member method code with example usage: obj.attach(cls, training_job_name, sagemaker_session, model_channel_name) and returns: estimator