Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
801 B
3
Indexable
Never
# Get the CloudWatch log group and log stream for the processing job
logs = boto3.client('logs')
log_groups = logs.describe_log_groups(
    logGroupNamePrefix=response['CreationTime'].strftime('/aws/sagemaker/ProcessingJobs/%Y/%m/%d/%H/')
)
log_group_name = log_groups['logGroups'][0]['logGroupName']
log_streams = logs.describe_log_streams(
    logGroupName=log_group_name
)
log_stream_name = log_streams['logStreams'][0]['logStreamName']

# Get the CloudWatch logs for the processing job
log_events = logs.filter_log_events(
    logGroupName=log_group_name,
    logStreamName=log_stream_name,
    filterPattern='',
    startTime=0,
    endTime=None,
    limit=None,
    nextToken=None
)

# Print the log events
for event in log_events['events']:
    print(event['message'])