from time import time
from luna_lambda_tools.public.lambda_context import LambdaContext
[docs]
async def getRemainingJobTime(context: LambdaContext) -> int:
"""Returns the remaining time until the job is forced to end"""
stopTime = context.lambdaStartTime + context.jobConfig["job_service_info"]["max_operating_time"]
return int(stopTime - time())
[docs]
async def getJobWorkTime(context: LambdaContext) -> int:
"""Returns the time since the start of the job."""
return int(time() - context.lambdaStartTime)