Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions emf/task_generator/manual_worker.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import json
import os
import sys
from emf.common.helpers.time import parse_duration, timezone
from datetime import datetime
import croniter
import config
import logging
from emf.task_generator.task_generator import generate_tasks
Expand Down Expand Up @@ -45,6 +48,7 @@
logger.error(f"RMM included TSOs can not be empty for the run type: {RUN_TYPE}")
sys.exit("Issue with input, check the EMFOS logs for possible error")

run_at = process_config_json[0]['runs'][0]['run_at']

# Update process configuration from ENV variables if defined
process_config_json[0]['runs'][0]['run_at'] = '* * * * *'
Expand All @@ -69,6 +73,12 @@
timeframe_config_json[0]['reference_time_end'] = TASK_REFERENCE_TIME
timeframe_config_json[0]['period_start'] = 'PT0M'
timeframe_config_json[0]['period_end'] = 'PT1H'
else:
day_start = datetime.now(tz=timezone(process_config_json[0]['time_zone'])).replace(hour=0, minute=0, second=0,
microsecond=0) + parse_duration(
PROCESS_TIME_SHIFT)
next_run = croniter.croniter(run_at, day_start).get_next(datetime).replace(second=1)
TIMESTAMP = next_run.isoformat()

# Generate tasks
tasks = list(generate_tasks(TASK_WINDOW_DURATION, TASK_WINDOW_REFERENCE, process_config_json, timeframe_config_json,
Expand Down
Loading