Skip to content

Commit 8194f1b

Browse files
committed
Removing logs_from_job from session_helper
1 parent 5030010 commit 8194f1b

File tree

2 files changed

+2
-25
lines changed

2 files changed

+2
-25
lines changed

sagemaker-core/src/sagemaker/core/helper/session_helper.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1866,30 +1866,6 @@ def expand_role(self, role):
18661866
return role
18671867
return self.boto_session.resource("iam").Role(role).arn
18681868

1869-
1870-
def logs_for_job(self, job_name, wait=False, poll=10, log_type="All", timeout=None):
1871-
"""Display logs for a given training job, optionally tailing them until job is complete.
1872-
1873-
If the output is a tty or a Jupyter cell, it will be color-coded
1874-
based on which instance the log entry is from.
1875-
1876-
Args:
1877-
job_name (str): Name of the training job to display the logs for.
1878-
wait (bool): Whether to keep looking for new log entries until the job completes
1879-
(default: False).
1880-
poll (int): The interval in seconds between polling for new log entries and job
1881-
completion (default: 5).
1882-
log_type ([str]): A list of strings specifying which logs to print. Acceptable
1883-
strings are "All", "None", "Training", or "Rules". To maintain backwards
1884-
compatibility, boolean values are also accepted and converted to strings.
1885-
timeout (int): Timeout in seconds to wait until the job is completed. ``None`` by
1886-
default.
1887-
Raises:
1888-
exceptions.CapacityError: If the training job fails with CapacityError.
1889-
exceptions.UnexpectedStatusException: If waiting and the training job fails.
1890-
"""
1891-
_logs_for_job(self, job_name, wait, poll, log_type, timeout)
1892-
18931869

18941870
def _expand_container_def(c_def):
18951871
"""Placeholder docstring"""

v3-examples/training-examples/aws_batch/sm-training-queues_getting_started_with_model_trainer.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@
232232
"outputs": [],
233233
"source": [
234234
"import time\n",
235+
"from utils.log_helpers import logs_for_job\n",
235236
"\n",
236237
"\n",
237238
"def list_jobs_in_training_queue(training_queue: TrainingQueue):\n",
@@ -299,7 +300,7 @@
299300
"\n",
300301
" # Print training job logs\n",
301302
" model_trainer = job.get_model_trainer()\n",
302-
" model_trainer.sagemaker_session.logs_for_job(model_trainer._latest_training_job.training_job_name, wait=True)\n",
303+
" logs_for_job(model_trainer, wait=True)\n",
303304
"\n",
304305
"\n",
305306
"logger.info(f\"Listing all jobs in queue '{queue.queue_name}'...\")\n",

0 commit comments

Comments
 (0)