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

487 add discopop version tag to patternsjson upon creation #488

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions discopop_library/discopop_optimizer/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
from discopop_library.discopop_optimizer.suggestions.optimizers.main import optimize_suggestions
from discopop_library.discopop_optimizer.utilities.simple_utilities import data_at
from discopop_library.discopop_optimizer.utilities.visualization.update_graph import show_update_graph
from discopop_library.global_data.version.utils import get_version
from discopop_library.result_classes.DetectionResult import DetectionResult
from discopop_library.discopop_optimizer.classes.system.System import System
from discopop_library.discopop_optimizer.Microbench.ExtrapInterpolatedMicrobench import (
Expand Down Expand Up @@ -105,6 +106,13 @@ def run(arguments: OptimizerArguments):
with open(os.path.join(explorer_dir, "detection_result_dump.json")) as f:
detection_result_dump_str = f.read()
detection_result: DetectionResult = jsonpickle.decode(detection_result_dump_str)
if detection_result.version != get_version():
warnings.warn(
"Restored DetectionResult was created using different DiscoPoP version: "
+ detection_result.version
+ "; current: "
+ get_version()
)
if arguments.verbose:
print("Done")

Expand Down
3 changes: 3 additions & 0 deletions discopop_library/result_classes/DetectionResult.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
from discopop_explorer.pattern_detectors.geometric_decomposition_detector import GDInfo
from discopop_explorer.pattern_detectors.pipeline_detector import PipelineInfo
from discopop_explorer.pattern_detectors.reduction_detector import ReductionInfo
from discopop_library.global_data.version.utils import get_version


class DetectionResult(object):
version: str
pet: PEGraphX
reduction: List[ReductionInfo]
do_all: List[DoAllInfo]
Expand All @@ -30,6 +32,7 @@ class DetectionResult(object):
optimizer_output: List[PatternBase]

def __init__(self, pet: PEGraphX):
self.version = get_version() # discopop version
self.pet = pet
self.optimizer_output = []
pass
Expand Down