-
Notifications
You must be signed in to change notification settings - Fork 2
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
DM-45896: adapt to change in QG builder #348
Open
TallJimbo
wants to merge
2
commits into
main
Choose a base branch
from
tickets/DM-45896
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -617,6 +617,8 @@ def __init__( | |||||
gather_task_label, gather_dataset_type_name = self._add_gather_task( | ||||||
pipeline_graph, input_metadata_dataset_type | ||||||
) | ||||||
if gather_task_label is None or gather_dataset_type_name is None: | ||||||
continue | ||||||
metadata_refs[gather_task_label] = refs_for_type | ||||||
consolidate_config.input_names.append(gather_dataset_type_name) | ||||||
pipeline_graph.add_task( | ||||||
|
@@ -637,18 +639,19 @@ def __init__( | |||||
# to do that again in process_subgraph, even though that's where most | ||||||
# QG builders do their queries. | ||||||
self.gather_inputs: dict[str, list[DatasetKey]] = {} | ||||||
self.existing_inputs: list[DatasetRef] = [] | ||||||
for gather_task_label, gather_input_refs in metadata_refs.items(): | ||||||
gather_inputs_for_task: list[DatasetKey] = [] | ||||||
for ref in gather_input_refs: | ||||||
dataset_key = DatasetKey(ref.datasetType.name, ref.dataId.required_values) | ||||||
self.existing_datasets.inputs[dataset_key] = ref | ||||||
self.existing_inputs.append(ref) | ||||||
gather_inputs_for_task.append(dataset_key) | ||||||
self.gather_inputs[gather_task_label] = gather_inputs_for_task | ||||||
|
||||||
@classmethod | ||||||
def _add_gather_task( | ||||||
cls, pipeline_graph: PipelineGraph, input_metadata_dataset_type: DatasetType | ||||||
) -> tuple[str, str]: | ||||||
) -> tuple[str | None, str | None]: | ||||||
"""Add a single configuration of `GatherResourceUsageTask` to a | ||||||
pipeline graph. | ||||||
|
||||||
|
@@ -663,15 +666,19 @@ def _add_gather_task( | |||||
|
||||||
Returns | ||||||
------- | ||||||
gather_task_label : `str` | ||||||
Label of the new task in the pipeline. | ||||||
gather_dataset_type_name : `str | ||||||
Name of the task's output table dataset type. | ||||||
gather_task_label : `str` or `None` | ||||||
Label of the new task in the pipeline, or `None` if the given | ||||||
dataset type is not a metadata dataset type or is itself a | ||||||
gatherResourceUsage metadata dataset type. | ||||||
gather_dataset_type_name : `str or `None` | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
Name of the task's output table dataset type, or `None` if the | ||||||
given dataset type is not a metadata dataset type or is itself a | ||||||
gatherResourceUsage metadata dataset type. | ||||||
""" | ||||||
if (m := re.fullmatch(r"^(\w+)_metadata$", input_metadata_dataset_type.name)) is None: | ||||||
return | ||||||
return None, None | ||||||
elif "gatherResourceUsage" in input_metadata_dataset_type.name: | ||||||
return | ||||||
return None, None | ||||||
else: | ||||||
input_task_label = m.group(1) | ||||||
gather_task_label = f"{input_task_label}_gatherResourceUsage" | ||||||
|
@@ -689,6 +696,9 @@ def _add_gather_task( | |||||
|
||||||
def process_subgraph(self, subgraph: PipelineGraph) -> QuantumGraphSkeleton: | ||||||
skeleton = QuantumGraphSkeleton(subgraph.tasks.keys()) | ||||||
for ref in self.existing_inputs: | ||||||
skeleton.add_dataset_node(ref.datasetType.name, ref.dataId) | ||||||
skeleton.set_dataset_ref(ref) | ||||||
consolidate_inputs = [] | ||||||
for task_node in subgraph.tasks.values(): | ||||||
if task_node.task_class is GatherResourceUsageTask: | ||||||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be
instead?