feat(chalice): debugging jobs execution

This commit is contained in:
Taha Yassine Kraiem 2023-04-12 14:07:47 +01:00 committed by rjshrjndrn
parent 9053719aef
commit cea886b619
2 changed files with 3 additions and 6 deletions

View file

@ -111,19 +111,13 @@ def get_scheduled_jobs():
WHERE status = %(status)s
AND start_at <= (now() at time zone 'utc');""",
{"status": JobStatus.SCHEDULED})
print(query)
cur.execute(query=query)
data = cur.fetchall()
print(">>>")
print(data)
return helper.list_to_camel_case(data)
def execute_jobs():
print(">>> looking for jobs to execute")
jobs = get_scheduled_jobs()
print(jobs)
for job in jobs:
print(f"Executing jobId:{job['jobId']}")
try:

View file

@ -110,11 +110,14 @@ def rename(source_bucket, source_key, target_bucket, target_key):
def schedule_for_deletion(bucket, key):
if not exists(bucket, key):
return False
s3 = __get_s3_resource()
s3_object = s3.Object(bucket, key)
s3_object.copy_from(CopySource={'Bucket': bucket, 'Key': key},
Expires=datetime.now() + timedelta(days=7),
MetadataDirective='REPLACE')
return True
def generate_file_key(project_id, key):