Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
749402b
WIP, need to fix the bug that runs all the graphs when i run only one
Elad-Zaharan Dec 3, 2025
d617774
need to remove unndecessary code before merging
Elad-Zaharan Dec 3, 2025
87e9fff
removed unnecessary module
Elad-Zaharan Dec 3, 2025
bdd98b8
Merge pull request #154 from qua-platform/main
Elad-Zaharan Dec 4, 2025
c054df9
ready for pr
Elad-Zaharan Dec 4, 2025
e827000
ready for pr
Elad-Zaharan Dec 4, 2025
566f7f1
ready for pr
Elad-Zaharan Dec 4, 2025
70d2474
ready for pr
Elad-Zaharan Dec 4, 2025
fe05d41
check wether it what fails the ci
Elad-Zaharan Dec 4, 2025
3e0c6e9
pr
Elad-Zaharan Dec 4, 2025
015ec67
pr
Elad-Zaharan Dec 4, 2025
65d2594
changed file names
Elad-Zaharan Dec 4, 2025
9d9bb77
finished adapting to operational operation concept, also started impl…
Elad-Zaharan Dec 7, 2025
140a3a5
connect on failure condition and conditional operation should work, n…
Elad-Zaharan Dec 10, 2025
ad17b92
tests for loop construct ready
Elad-Zaharan Dec 11, 2025
b33d7f3
linted code
Elad-Zaharan Dec 11, 2025
fe8b7c6
linted code
Elad-Zaharan Dec 11, 2025
f2b7eec
linted code
Elad-Zaharan Dec 11, 2025
afc5360
removed unused code
Elad-Zaharan Dec 11, 2025
57f0c52
finished operational condition + connection failed conditional + fixe…
Elad-Zaharan Dec 17, 2025
0dbb21a
lint
Elad-Zaharan Dec 17, 2025
6196ea4
removed commented code
Elad-Zaharan Dec 17, 2025
cb9eb41
removed commented code
Elad-Zaharan Dec 17, 2025
f3f349a
changed serialization for ui and fixed broken serialization tests
Elad-Zaharan Dec 17, 2025
cfac68c
fixed bug and removed comented code, also removed unnecessary code
Elad-Zaharan Dec 17, 2025
f40abe0
fixed a bug, unknown import happened
Elad-Zaharan Dec 17, 2025
af162ec
WIP everything is done include testing BUT still need product charact…
Elad-Zaharan Dec 21, 2025
e60f662
WIP, need to solve bug, in order todo that need product characterisat…
Elad-Zaharan Dec 21, 2025
bdcd259
fixed all mypy errors, need to lint
Elad-Zaharan Dec 21, 2025
6b7ac9b
changed graphs names
Elad-Zaharan Dec 22, 2025
7f6d5da
fixed schema for ui, still need product to give characterisation for …
Elad-Zaharan Dec 22, 2025
2a0ea90
added enums, need to add tests
Elad-Zaharan Dec 23, 2025
4935e68
added tests can merge after linting
Elad-Zaharan Dec 23, 2025
2bcc6fd
removed commented content
Elad-Zaharan Dec 23, 2025
96f13d1
linted ready to merge
Elad-Zaharan Dec 23, 2025
27bad1d
fixed orchestrator target results bug, reformat code and linting and …
Elad-Zaharan Dec 23, 2025
7de127f
fixed orchestrator bug case, seem that all tests are good, need to ma…
Elad-Zaharan Dec 24, 2025
eac42ea
added tests for new orchestrator logic
Elad-Zaharan Dec 24, 2025
0f4af6e
linted some, still linting missing, need to finish linting
Elad-Zaharan Dec 24, 2025
13fd14a
linted the code, theres a bug where it complains about a line and aft…
Elad-Zaharan Dec 24, 2025
2891aac
removed commented code and fixed test
Elad-Zaharan Dec 24, 2025
9d69e89
qubits work, need to make sure change in node doesnt break anything a…
Elad-Zaharan Dec 25, 2025
e1ef2f3
added testing for new qubits serialization
Elad-Zaharan Dec 28, 2025
24a345c
linted the code
Elad-Zaharan Dec 28, 2025
4b86d07
removed commented code
Elad-Zaharan Dec 28, 2025
c473c22
removed comments
Elad-Zaharan Dec 28, 2025
4d678a2
finished cr
Elad-Zaharan Dec 28, 2025
c7d585e
added comments
Elad-Zaharan Dec 28, 2025
bfd5301
finished cr
Elad-Zaharan Dec 28, 2025
19f4b78
finished cr comments
Elad-Zaharan Dec 28, 2025
81741ff
Merge pull request #157 from qua-platform/feat/adapt_serialization_af…
Elad-Zaharan Dec 28, 2025
bf60b66
linted
Elad-Zaharan Dec 28, 2025
27ba843
added log info
Elad-Zaharan Dec 28, 2025
7d59992
fixed line
Elad-Zaharan Dec 28, 2025
75adaa9
linted
Elad-Zaharan Dec 28, 2025
8a8372c
linted
Elad-Zaharan Dec 28, 2025
b949eba
fix tests for ci, was a wrong import
Elad-Zaharan Dec 28, 2025
7ea9170
linted
Elad-Zaharan Dec 28, 2025
24a01ea
trying to fix testing for ci
Elad-Zaharan Dec 28, 2025
9e1a363
Merge pull request #156 from qua-platform/feat/add_conditional_operat…
Elad-Zaharan Dec 28, 2025
e6459f9
Merge branch 'feat/add_graphs_for_testing' into feat/apply_enums_in_p…
Elad-Zaharan Dec 28, 2025
4b876a0
linted
Elad-Zaharan Dec 28, 2025
2a0938f
Merge pull request #158 from qua-platform/feat/apply_enums_in_parameters
Elad-Zaharan Dec 28, 2025
aeabf28
Merge branch 'feat/add_graphs_for_testing' into feat/add_loop_constru…
Elad-Zaharan Dec 28, 2025
5631212
fixed conflict
Elad-Zaharan Dec 28, 2025
5acf08d
linted
Elad-Zaharan Dec 28, 2025
5f8257c
Merge pull request #155 from qua-platform/feat/add_loop_construct_tests
Elad-Zaharan Dec 28, 2025
4239395
Merge pull request #159 from qua-platform/feat/add_qubits_special_ser…
Elad-Zaharan Dec 28, 2025
12d8e50
Merge pull request #153 from qua-platform/feat/add_graphs_for_testing
Elad-Zaharan Dec 28, 2025
807d5a9
added validation, need to fix test and add new tests
Elad-Zaharan Dec 29, 2025
2368cf9
ready for merge
Elad-Zaharan Dec 29, 2025
27f87ba
ready for merge
Elad-Zaharan Dec 29, 2025
d0a85dd
Merge pull request #161 from qua-platform/feat/validate_connect_on_su…
Elad-Zaharan Dec 29, 2025
f0009d3
first version of qubits for graphs
Elad-Zaharan Dec 30, 2025
8fbf4fa
push before major changes, will add tests and refactor method
Elad-Zaharan Dec 31, 2025
2348e9b
WIP pushing to test ui
Elad-Zaharan Dec 31, 2025
91b2b75
finished graph serialization tests
Elad-Zaharan Dec 31, 2025
6bac5c6
linted, still need to finish linting
Elad-Zaharan Dec 31, 2025
b55951f
finishe with cr and linting
Elad-Zaharan Dec 31, 2025
9c8a9ea
removed commented code
Elad-Zaharan Dec 31, 2025
f506b4f
fixed {} and None logic
Elad-Zaharan Jan 1, 2026
75aed71
linted
Elad-Zaharan Jan 1, 2026
160524c
Merge pull request #164 from qua-platform/feat/add_qubit_serializatio…
Elad-Zaharan Jan 1, 2026
25a0f82
version release 0.6.0
Elad-Zaharan Jan 1, 2026
e02b120
Merge pull request #165 from qua-platform/feat/release_0.6.0
Elad-Zaharan Jan 1, 2026
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
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "qualibrate-core"
version = "0.5.0"
version = "0.6.0"
description = ""
authors = ["Quantum Machines <info@quantum-machines.co>"]
readme = "README.md"
Expand Down Expand Up @@ -41,6 +41,7 @@ poethepoet = "^0.37.0"
line-length = 80
target-version = "py310"
exclude = ["calibrations"]
ignore = ["E501"]

[tool.ruff.lint]
select = [
Expand All @@ -53,8 +54,8 @@ select = [
]

[tool.ruff.lint.pycodestyle]
max-line-length = 80
max-doc-length = 80
max-line-length = 120
max-doc-length = 120

[tool.mypy]
python_version = "3.10"
Expand Down
25 changes: 25 additions & 0 deletions qualibrate/models/operational_condition.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from collections.abc import Callable, Generator
from typing import Generic

from pydantic import BaseModel

from qualibrate.utils.graph_building import GraphElementTypeVar
from qualibrate.utils.type_protocols import TargetType


class OperationalCondition(BaseModel, Generic[GraphElementTypeVar]):
on_function: Callable[[GraphElementTypeVar, TargetType], bool] | None = None
on_generator: (
Callable[
[],
Generator[
bool, tuple[GraphElementTypeVar, TargetType] | None, None
],
]
| None
) = None


class LoopCondition(OperationalCondition[GraphElementTypeVar]):
max_iterations: int | None = None
on_failure: bool = False
69 changes: 61 additions & 8 deletions qualibrate/orchestration/basic_orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
ItemMetadata,
)
from qualibrate.models.node_status import ElementRunStatus
from qualibrate.models.operational_condition import OperationalCondition
from qualibrate.models.outcome import Outcome
from qualibrate.models.run_summary.base import BaseRunSummary
from qualibrate.models.run_summary.run_error import RunError
Expand Down Expand Up @@ -125,6 +126,12 @@ def get_next_element(self) -> GraphElementTypeVar | None:
"""
while not self._execution_queue.empty():
element_to_run = self._execution_queue.get()
# Skip if already finished (handles duplicate queue entries)
# for cases like diamond cases where a-> b,c b,c->d
# d will be twice in queue and we dont want to execute it twice
if self.check_node_finished(element_to_run):
continue

if all(
map(
self.check_node_finished, self.nx_graph.pred[element_to_run]
Expand Down Expand Up @@ -211,8 +218,12 @@ def _set_out_targets_for_element(
f"Can't set out targets of {element} without run summary"
)

# self.nx_graph.edges[element, successor]["operational_condition"]
# is of type OperationalCondition
has_on_failed_successors = any(
self.nx_graph.edges[element, successor]["scenario"]
self.nx_graph.edges[element, successor][
QualibrationGraph.RUN_SCENARIO_FIELD
]
== Outcome.FAILED
for successor in self.nx_graph.successors(element)
)
Expand All @@ -225,9 +236,17 @@ def _set_out_targets_for_element(
QualibrationGraph.EDGE_TARGETS_FIELD
] = (
successful_out_targets
if self.nx_graph.edges[element, successor]["scenario"]
if self.nx_graph.edges[element, successor][
QualibrationGraph.RUN_SCENARIO_FIELD
]
== Outcome.SUCCESSFUL
else failed_out_targets
else self._execute_condition(
self.nx_graph.edges[element, successor][
QualibrationGraph.OPERATIONAL_CONDITION_FIELD
],
element,
failed_out_targets,
)
)
else:
successful_out_targets = (
Expand All @@ -241,6 +260,31 @@ def _set_out_targets_for_element(
QualibrationGraph.EDGE_TARGETS_FIELD
] = successful_out_targets

def _execute_condition(
self,
operational_condition: OperationalCondition[GraphElementTypeVar],
element: GraphElementTypeVar,
targets: list[TargetType],
) -> list[TargetType]:
if operational_condition.on_generator is not None:
executed_condition = operational_condition.on_generator()
# priming the generator, we need to get to the point
# where the generator expects out two variables
executed_condition.send(None)
return [
target
for target in targets
if executed_condition.send((element, target))
]
elif operational_condition.on_function is not None:
return [
target
for target in targets
if operational_condition.on_function(element, target)
]
# No condition specified, return all targets
return targets

def _execute_loop_iteration(
self,
element_to_run: GraphElementTypeVar,
Expand Down Expand Up @@ -510,19 +554,28 @@ def _fill_final_outcomes(self) -> None:
elements_without_successors = list(
filter(lambda n: len(successors[n]) == 0, successors.keys())
)
for target in self.initial_targets or []:
final_targets = {
target
for element in elements_without_successors
for target in element.outcomes
}
skipped_targets = set(self.initial_targets or []) - final_targets
for target in final_targets:
outcomes = [
node.outcomes.get(target, Outcome.SUCCESSFUL)
for node in elements_without_successors
]
successful = all(
map(
lambda outcome: outcome == Outcome.SUCCESSFUL,
[
node.outcomes.get(target, Outcome.FAILED)
for node in elements_without_successors
],
outcomes,
)
)
self.final_outcomes[target] = (
Outcome.SUCCESSFUL if successful else Outcome.FAILED
)
for skipped_target in skipped_targets:
self.final_outcomes[skipped_target] = Outcome.FAILED


def _current_and_predecessors_statuses(
Expand Down
4 changes: 4 additions & 0 deletions qualibrate/q_runnnable.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ def run(self, **passed_parameters: Any) -> BaseRunSummary:
"""
pass

@abstractmethod
def _get_machine_metadata(self) -> Mapping[str, Any] | None:
pass

@property
def parameters(self) -> CreateParametersType:
"""
Expand Down
Loading
Loading