Skip to content

Commit

Permalink
Merge pull request #106 from Project-OMOTES/105-add-job-reference-whe…
Browse files Browse the repository at this point in the history
…n-submitting-a-job

105 add job reference when submitting a job
  • Loading branch information
lfse-slafleur authored Oct 15, 2024
2 parents 8dfcc3d + 5817700 commit 29d41f6
Show file tree
Hide file tree
Showing 16 changed files with 44 additions and 13 deletions.
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ services:
- manual_dev

orchestrator:
image: ghcr.io/project-omotes/omotes_orchestrator:1.1.0
image: ghcr.io/project-omotes/omotes_orchestrator:1.2.0
restart: unless-stopped
networks:
- omotes
Expand Down Expand Up @@ -126,7 +126,7 @@ services:
condition: service_healthy

grow_worker_optimizer: &grow_worker
image: ghcr.io/project-omotes/omotes-grow-optimizer-worker:2.0.3
image: ghcr.io/project-omotes/omotes-grow-optimizer-worker:2.0.4
restart: unless-stopped
deploy:
replicas: 2
Expand Down Expand Up @@ -174,7 +174,7 @@ services:
GROW_TASK_TYPE: grow_optimizer_with_pressure

omotes_simulator_worker:
image: ghcr.io/project-omotes/omotes-simulator-worker:0.0.12
image: ghcr.io/project-omotes/omotes-simulator-worker:0.0.13
restart: unless-stopped
deploy:
replicas: 2
Expand Down
1 change: 1 addition & 0 deletions example_sdk_client/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def handle_on_progress_update(job: Job, progress_update: JobProgressUpdate):

omotes_if.submit_job(
esdl=input_esdl,
job_reference="example_sdk_client.optimizer",
params_dict={"key1": "value1", "key2": ["just", "a", "list", "with", "an", "integer", 3]},
workflow_type=workflow_optimizer,
job_timeout=timedelta(hours=1),
Expand Down
1 change: 1 addition & 0 deletions example_sdk_client/optimizer_cancel.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def handle_on_progress_update(job: Job, progress_update: JobProgressUpdate):

job = omotes_if.submit_job(
esdl=input_esdl,
job_reference="example_sdk_client.optimizer_cancel",
params_dict={"key1": "value1", "key2": ["just", "a", "list", "with", "an", "integer", 3]},
workflow_type=workflow_optimizer,
job_timeout=timedelta(hours=1),
Expand Down
1 change: 1 addition & 0 deletions example_sdk_client/reconnect.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def handle_on_progress_update(job: Job, progress_update: JobProgressUpdate):
)
submitted_job: Job = omotes_if_1.submit_job(
esdl=input_esdl,
job_reference="example_sdk_client.optimizer_reconnect",
params_dict={"key1": "value1", "key2": ["just", "a", "list", "with", "an", "integer", 3]},
workflow_type=workflow_optimizer,
job_timeout=timedelta(hours=1),
Expand Down
2 changes: 1 addition & 1 deletion example_sdk_client/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
omotes_sdk_python==3.1.2
omotes-sdk-python==3.2.2
1 change: 1 addition & 0 deletions example_sdk_client/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def handle_on_progress_update(job: Job, progress_update: JobProgressUpdate):

omotes_if.submit_job(
esdl=input_esdl,
job_reference="example_sdk_client.simulator",
params_dict={
"timestep": datetime.timedelta(hours=1),
"start_time": datetime.datetime(2019, 1, 2, 0, 0, 0),
Expand Down
3 changes: 2 additions & 1 deletion system_tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
omotes_sdk_python==3.1.2
omotes-sdk-python==3.2.2
pytest ~= 8.1.2
pytest-timeout
xmltodict ~= 0.13.0
pip-tools
deepdiff ~= 7.0
pyesdl ~= 24.2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<esdl:EnergySystem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:esdl="http://www.tno.nl/esdl" version="13" description="" esdlVersion="v2207" name="PoC Tutorial_SmartControlOptimized_GrowOptimized" id="f04e36f1-85f8-4a0b-aeb5-f569cb3f09a5">
<esdl:EnergySystem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:esdl="http://www.tno.nl/esdl" version="13" description="" esdlVersion="v2207" name="PoC Tutorial_SmartControlOptimized_grow_optimizer_default" id="f04e36f1-85f8-4a0b-aeb5-f569cb3f09a5">
<instance xsi:type="esdl:Instance" name="Untitled instance" id="9af52a01-24e2-4bbe-a7b8-f868161e6ca3">
<area xsi:type="esdl:Area" name="Untitled area" id="9edf5aa3-3855-4dac-b6f5-01c2edf1a43a">
<KPIs xsi:type="esdl:KPIs" id="b8808077-0cf5-46f1-b6fb-c74ec4173743">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<esdl:EnergySystem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:esdl="http://www.tno.nl/esdl" version="6" description="" esdlVersion="v2207" name="PoC Tutorial_GrowOptimized" id="9a8a8e72-eb00-4987-af33-444665a17717">
<esdl:EnergySystem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:esdl="http://www.tno.nl/esdl" version="6" description="" esdlVersion="v2207" name="PoC Tutorial_grow_optimizer_default" id="9a8a8e72-eb00-4987-af33-444665a17717">
<instance xsi:type="esdl:Instance" name="Untitled instance" id="9af52a01-24e2-4bbe-a7b8-f868161e6ca3">
<area xsi:type="esdl:Area" name="Untitled area" id="9edf5aa3-3855-4dac-b6f5-01c2edf1a43a">
<KPIs xsi:type="esdl:KPIs" id="844ab6bb-e1a7-4174-a5ab-99b830336ebe">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<esdl:EnergySystem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:esdl="http://www.tno.nl/esdl" version="13" description="" esdlVersion="v2207" name="PoC Tutorial_SmartControlOptimized_GrowOptimized" id="596430ff-3f53-435a-98b2-a87f7a68e905">
<esdl:EnergySystem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:esdl="http://www.tno.nl/esdl" version="13" description="" esdlVersion="v2207" name="PoC Tutorial_SmartControlOptimized_grow_optimizer_default" id="596430ff-3f53-435a-98b2-a87f7a68e905">
<instance xsi:type="esdl:Instance" name="Untitled instance" id="9af52a01-24e2-4bbe-a7b8-f868161e6ca3">
<area xsi:type="esdl:Area" name="Untitled area" id="9edf5aa3-3855-4dac-b6f5-01c2edf1a43a">
<KPIs xsi:type="esdl:KPIs" id="d207faf5-5693-4103-99fa-563e717fc89d">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<esdl:EnergySystem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:esdl="http://www.tno.nl/esdl" version="13" description="" esdlVersion="v2207" name="PoC Tutorial_SmartControlOptimized_GrowOptimized" id="4a11ba4b-6584-465e-9c32-9979a9569f5b">
<esdl:EnergySystem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:esdl="http://www.tno.nl/esdl" version="13" description="" esdlVersion="v2207" name="PoC Tutorial_SmartControlOptimized_grow_optimizer_default" id="4a11ba4b-6584-465e-9c32-9979a9569f5b">
<instance xsi:type="esdl:Instance" name="Untitled instance" id="9af52a01-24e2-4bbe-a7b8-f868161e6ca3">
<area xsi:type="esdl:Area" name="Untitled area" id="9edf5aa3-3855-4dac-b6f5-01c2edf1a43a">
<KPIs xsi:type="esdl:KPIs" id="eb40470f-c0dd-4c0e-b3bf-4089c81d8a3a">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<esdl:EnergySystem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:esdl="http://www.tno.nl/esdl" version="13" description="" esdlVersion="v2207" name="PoC Tutorial_SmartControlOptimized_GrowOptimized" id="fc1209d0-1c18-45a0-80b3-1752aee1c6e6">
<esdl:EnergySystem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:esdl="http://www.tno.nl/esdl" version="13" description="" esdlVersion="v2207" name="PoC Tutorial_SmartControlOptimized_grow_optimizer_no_heat_losses" id="fc1209d0-1c18-45a0-80b3-1752aee1c6e6">
<instance xsi:type="esdl:Instance" name="Untitled instance" id="9af52a01-24e2-4bbe-a7b8-f868161e6ca3">
<area xsi:type="esdl:Area" name="Untitled area" id="9edf5aa3-3855-4dac-b6f5-01c2edf1a43a">
<KPIs xsi:type="esdl:KPIs" id="ad32c192-a28a-4b2d-ae92-632fdf47ddca">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<esdl:EnergySystem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:esdl="http://www.tno.nl/esdl" version="13" description="" esdlVersion="v2207" name="PoC Tutorial_SmartControlOptimized_GrowOptimized" id="b3020a9c-3f81-4851-9ab7-272001aa24ec">
<esdl:EnergySystem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:esdl="http://www.tno.nl/esdl" version="13" description="" esdlVersion="v2207" name="PoC Tutorial_SmartControlOptimized_grow_optimizer_with_pressure" id="b3020a9c-3f81-4851-9ab7-272001aa24ec">
<instance xsi:type="esdl:Instance" name="Untitled instance" id="9af52a01-24e2-4bbe-a7b8-f868161e6ca3">
<area xsi:type="esdl:Area" name="Untitled area" id="9edf5aa3-3855-4dac-b6f5-01c2edf1a43a">
<KPIs xsi:type="esdl:KPIs" id="5737d7a4-25c9-4b79-a7a4-6f4aa4b71872">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<esdl:EnergySystem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:esdl="http://www.tno.nl/esdl" version="13" description="" esdlVersion="v2207" name="PoC Tutorial_SmartControlOptimized_Simulation" id="41489647-1737-4df6-88cc-560eb813dea7">
<esdl:EnergySystem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:esdl="http://www.tno.nl/esdl" version="13" description="" esdlVersion="v2207" name="PoC Tutorial_SmartControlOptimized_grow_simulator" id="41489647-1737-4df6-88cc-560eb813dea7">
<instance xsi:type="esdl:Instance" id="9af52a01-24e2-4bbe-a7b8-f868161e6ca3" name="Untitled instance">
<area xsi:type="esdl:Area" id="9edf5aa3-3855-4dac-b6f5-01c2edf1a43a" name="Untitled area">
<KPIs xsi:type="esdl:KPIs" id="c7a97113-8939-4320-8fcc-3a50bed5d77a">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<esdl:EnergySystem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:esdl="http://www.tno.nl/esdl" esdlVersion="v2207" version="1" description="" name="Untitled EnergySystem with return network" id="b793211c-6cee-4b56-812d-110a51b2180d">
<esdl:EnergySystem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:esdl="http://www.tno.nl/esdl" esdlVersion="v2207" version="1" description="" name="Untitled EnergySystem with return network_simulator" id="b793211c-6cee-4b56-812d-110a51b2180d">
<energySystemInformation xsi:type="esdl:EnergySystemInformation" id="c615f17e-c077-48c4-8a78-6ae05f8a908f">
<quantityAndUnits xsi:type="esdl:QuantityAndUnits" id="f61a1799-bf04-416a-b15e-93097722ada7">
<quantityAndUnit xsi:type="esdl:QuantityAndUnitType" physicalQuantity="POWER" description="Power in MW" id="e9405fc8-5e57-4df5-8584-4babee7cdf1b" multiplier="MEGA" unit="WATT"/>
Expand Down
26 changes: 26 additions & 0 deletions system_tests/src/test_workflows_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import xmltodict
from deepdiff import DeepDiff
from omotes_sdk.types import ParamsDict
import esdl.esdl_handler


RABBITMQ_CONFIG = RabbitMQConfig(
Expand Down Expand Up @@ -285,3 +286,28 @@ def test__grow_optimizer_default__happy_path_2ndsource_merit_order_swapped(self)
"./test_esdl/output/test__grow_optimizer_default__happy_path_2ndsource_merit_order_swapped.esdl"
)
self.compare_esdl(expected_esdl, result_handler.result.output_esdl)

def test__simulator__job_reference_is_set(self) -> None:
# Arrange
result_handler = OmotesJobHandler()
esdl_file = retrieve_esdl_file("./test_esdl/input/simulator_tutorial.esdl")
workflow_type = "simulator"
timeout_seconds = 60.0
params_dict = {
"timestep": datetime.timedelta(hours=1),
"start_time": datetime.datetime(2019, 1, 1, 0, 0, 0),
"end_time": datetime.datetime(2019, 1, 1, 3, 0, 0),
}

# Act
with omotes_client() as omotes_client_:
submit_a_job(omotes_client_, esdl_file, workflow_type, params_dict, result_handler)
result_handler.wait_until_result(timeout_seconds)

# Assert
self.expect_a_result(result_handler, JobResult.SUCCEEDED)
output_esh = esdl.esdl_handler.EnergySystemHandler()
output_esh.load_from_string(result_handler.result.output_esdl)
self.assertEqual(
output_esh.energy_system.name, "Untitled EnergySystem with return network_simulator"
)

0 comments on commit 29d41f6

Please sign in to comment.