Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try foreasting and scheduling jobs for up to one day #198

Merged
merged 3 commits into from Oct 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions documentation/changelog.rst
Expand Up @@ -23,6 +23,7 @@ Infrastructure / Support
* Set default timezone for new users using the FLEXMEASURES_TIMEZONE config setting [see `PR #190 <http://www.github.com/SeitaBV/flexmeasures/pull/190>`_]
* Monitored CLI tasks can get better names for identification [see `PR #193 <http://www.github.com/SeitaBV/flexmeasures/pull/193>`_]
* Less custom logfile location, document logging for devs [see `PR #196 <http://www.github.com/SeitaBV/flexmeasures/pull/196>`_]
* Keep forecasting and scheduling jobs in the queues for only up to one day [see `PR #198 <http://www.github.com/SeitaBV/flexmeasures/pull/198>`_]


v0.6.1 | September XX, 2021
Expand Down
10 changes: 10 additions & 0 deletions documentation/configuration.rst
Expand Up @@ -207,6 +207,16 @@ Timezone in which the platform operates. This is useful when datetimes are being

Default: ``"Asia/Seoul"``


FLEXMEASURES_JOB_TTL
^^^^^^^^^^^^^^^^^^^^^^^^^

Time to live for jobs (e.g. forecasting, scheduling) in their respective queue.

A job that is passed this time to live might get cleaned out by Redis' memory manager.

Default: ``timedelta(days=1)``

FLEXMEASURES_PLANNING_TTL
^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
5 changes: 5 additions & 0 deletions flexmeasures/data/services/forecasting.py
Expand Up @@ -108,6 +108,11 @@ def create_forecasting_jobs(
custom_model_params=custom_model_params,
),
connection=current_app.queues["forecasting"].connection,
ttl=int(
current_app.config.get(
"FLEXMEASURES_JOB_TTL", timedelta(-1)
).total_seconds()
),
)
job.meta["model_search_term"] = model_search_term
job.save_meta()
Expand Down
5 changes: 5 additions & 0 deletions flexmeasures/data/services/scheduling.py
Expand Up @@ -64,6 +64,11 @@ def create_scheduling_job(
),
id=udi_event_ea,
connection=current_app.queues["scheduling"].connection,
ttl=int(
current_app.config.get(
"FLEXMEASURES_JOB_TTL", timedelta(-1)
).total_seconds()
),
result_ttl=int(
current_app.config.get(
"FLEXMEASURES_PLANNING_TTL", timedelta(-1)
Expand Down
1 change: 1 addition & 0 deletions flexmeasures/utils/config_defaults.py
Expand Up @@ -110,6 +110,7 @@ class Config(object):
FLEXMEASURES_MENU_LISTED_VIEW_ICONS: Dict[str, str] = {}
FLEXMEASURES_MENU_LISTED_VIEW_TITLES: Dict[str, str] = {}
FLEXMEASURES_LP_SOLVER: str = "cbc"
FLEXMEASURES_JOB_TTL: timedelta = timedelta(days=1)
FLEXMEASURES_PLANNING_HORIZON: timedelta = timedelta(hours=2 * 24)
FLEXMEASURES_PLANNING_TTL: timedelta = timedelta(
days=7
Expand Down