repos/serving/lambdas/functions/processing-job-execution/lambda_function.py [8:35]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
logger = logging.getLogger()
logger.setLevel(logging.INFO)
logging.basicConfig(format="%(asctime)s - %(message)s", level=logging.INFO)

# Retrieve region where Lambda is being executed
region_name = os.environ["AWS_REGION"]  # "ap-southeast-1"

# Create a client for the AWS Analytical service to use
client = boto3.client("glue")
sagemaker = boto3.client("sagemaker")


def datetimeconverter(o):
    if isinstance(o, dt.datetime):
        return o.__str__()


def check_job_status(job_details):
    # This function checks the status of the currently running job
    job_response = client.get_job_run(
        JobName=job_details["jobName"], RunId=job_details["jobRunId"]
    )
    json_data = json.loads(json.dumps(job_response, default=datetimeconverter))
    # IMPORTANT update the status of the job based on the job_response (e.g RUNNING, SUCCEEDED, FAILED)
    job_details["jobStatus"] = json_data.get("JobRun").get("JobRunState")

    response = {"jobDetails": job_details}
    return response
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



repos/serving/lambdas/functions/processing-job-status-check/lambda_function.py [8:36]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
logger = logging.getLogger()
logger.setLevel(logging.INFO)
logging.basicConfig(format="%(asctime)s - %(message)s", level=logging.INFO)

# Retrieve region where Lambda is being executed
region_name = os.environ["AWS_REGION"]  # "ap-southeast-1"

# Create a client for the AWS Analytical service to use
client = boto3.client("glue")

sagemaker = boto3.client("sagemaker")


def datetimeconverter(o):
    if isinstance(o, dt.datetime):
        return o.__str__()


def check_job_status(job_details):
    # This function checks the status of the currently running job
    job_response = client.get_job_run(
        JobName=job_details["jobName"], RunId=job_details["jobRunId"]
    )
    json_data = json.loads(json.dumps(job_response, default=datetimeconverter))
    # IMPORTANT update the status of the job based on the job_response (e.g RUNNING, SUCCEEDED, FAILED)
    job_details["jobStatus"] = json_data.get("JobRun").get("JobRunState")

    response = {"jobDetails": job_details}
    return response
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



