Skip to content
Open
Show file tree
Hide file tree
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
26 changes: 26 additions & 0 deletions .idea/runConfigurations/main.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Orchestrator",
"type": "debugpy",
"request": "launch",
"module": "omotes_orchestrator.main",
"cwd": "${workspaceFolder}/src",
"envFile": "${workspaceFolder}/.env",
"console": "integratedTerminal",
"justMyCode": true
}
]
}
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ classifiers = [
"Topic :: Scientific/Engineering :: Physics",
]
readme = "README.md"
license = {file = "LICENSE"}
license = { file = "LICENSE" }
requires-python = ">=3.10"

dependencies = [
Expand Down Expand Up @@ -53,7 +53,7 @@ dev = [
"isort == 5.13.2",
"build ~= 1.2.2",
"sqlalchemy[mypy]",
"types-protobuf ~= 4.24.0"
"types-protobuf ~= 4.24.0",
]

[project.urls]
Expand Down Expand Up @@ -93,11 +93,11 @@ ignore = [
'C408', # Suggestion to use dict() over {}
'W503', # Starting lines with operators.
'D104', # Missing docstring in public package
'D100' # Missing docstring in public module
'D100', # Missing docstring in public module
]
per-file-ignores = [
'__init__.py:F401',
'./unit_test/*:D100,D101,D102,D103,D106,D107'
'./unit_test/*:D100,D101,D102,D103,D106,D107',
]
max-line-length = 100
count = true
Expand Down Expand Up @@ -135,4 +135,4 @@ ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "influxdb.*"
ignore_missing_imports = true
ignore_missing_imports = true
44 changes: 30 additions & 14 deletions src/omotes_orchestrator/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,7 @@ def start(self) -> None:

self.celery_if.start()

self.worker_if.start()
self.worker_if.connect_to_worker_task_results(
callback_on_worker_task_result=self.task_result_received
)
self.worker_if.connect_to_worker_task_progress_updates(
callback_on_worker_task_progress_update=self.task_progress_update
)

# Initialize SDK-side broker and exchange before worker callbacks can emit results.
self.omotes_sdk_if.start()
self.omotes_sdk_if.connect_to_job_submissions(
callback_on_new_job=self.new_job_submitted_handler
Expand All @@ -245,6 +238,14 @@ def start(self) -> None:
)
self.omotes_sdk_if.send_available_workflows()

self.worker_if.start()
self.worker_if.connect_to_worker_task_results(
callback_on_worker_task_result=self.task_result_received
)
self.worker_if.connect_to_worker_task_progress_updates(
callback_on_worker_task_progress_update=self.task_progress_update
)

self.postgres_job_manager.start()
self.timeout_job_manager.start()
self.esdl_time_series_manager.start()
Expand Down Expand Up @@ -459,12 +460,27 @@ def _guard_time_series_data_from_cleanup(
:param job_id: ID of the job that created this ESDL.
:param job_reference: Reference of the job that created this ESDL.
"""
output_esdl_id = pyesdl_from_string(esdl).energy_system.id
self.postgresql_if.put_new_esdl_time_series_info(
output_esdl_id=output_esdl_id,
job_id=job_id,
job_reference=job_reference,
)
try:
output_esdl_id = pyesdl_from_string(esdl).energy_system.id
if not isinstance(output_esdl_id, str) or not output_esdl_id:
logger.warning(
"Could not guard time series data for job %s: missing or invalid "
"energy system id in output ESDL.",
job_id,
)
return

self.postgresql_if.put_new_esdl_time_series_info(
output_esdl_id=output_esdl_id,
job_id=job_id,
job_reference=job_reference,
)
except Exception:
logger.exception(
"Could not parse output ESDL to guard time series data for job %s. "
"Continuing without guard.",
job_id,
)

def task_result_received(self, task_result: TaskResult) -> None:
"""When a task result is received from a worker through RabbitMQ, Celery side.
Expand Down
Loading