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

manager.generate_report fails in CLI mode #88

Closed
deniederhut opened this issue Oct 3, 2023 · 1 comment
Closed

manager.generate_report fails in CLI mode #88

deniederhut opened this issue Oct 3, 2023 · 1 comment
Labels
bug Something isn't working
Projects

Comments

@deniederhut
Copy link

Describe the bug
When running curifactory in CLI mode, generating a report inside the run causes a failure

To Reproduce
Here is the experiment definition, inside an experiments folder:

from dataclasses import dataclass

from curifactory import ArtifactManager, Record, stage
from curifactory.caching import Lazy, PickleCacher


@stage(inputs=None, outputs=[Lazy("initial_value")], cachers=[PickleCacher])
def get_initial_value(record):
    my_value = 5
    return my_value * record.params.number

@stage(inputs=["initial_value"], outputs=["final_value"], cachers=[PickleCacher])
def multiply_again(record, initial_value):
    return initial_value * record.params.number

def run(param_sets, manager):
    for param_set in param_sets:
        record = Record(manager, param_set)
        result = multiply_again(get_initial_value(record))
    manager.generate_report()

with params in a params directory that look like this

from dataclasses import dataclass

from curifactory import ExperimentParameters


@dataclass
class MyParams(ExperimentParameters):
    number: float = 1.0

def get_params():
    return [MyParams(number=number) for number in (0, 1, 2, 2)]

Running this with experiment run -p basic_params fails with

Traceback (most recent call last):
  File "/Users/dillon/miniconda3/envs/curifactory-dev/bin/experiment", line 8, in <module>
    sys.exit(main())
  File "/Users/dillon/miniconda3/envs/curifactory-dev/lib/python3.9/site-packages/curifactory/experiment.py", line 1380, in main
    run_experiment(
  File "/Users/dillon/miniconda3/envs/curifactory-dev/lib/python3.9/site-packages/curifactory/experiment.py", line 756, in run_experiment
    mngr.generate_report()
  File "/Users/dillon/miniconda3/envs/curifactory-dev/lib/python3.9/site-packages/curifactory/manager.py", line 574, in generate_report
    reporting.run_report(self, self.reports_path, "_latest", self.report_css_path)
  File "/Users/dillon/miniconda3/envs/curifactory-dev/lib/python3.9/site-packages/curifactory/reporting.py", line 655, in run_report
    html_lines.extend(render_report_stage_map(manager, graphs_path))
  File "/Users/dillon/miniconda3/envs/curifactory-dev/lib/python3.9/site-packages/curifactory/reporting.py", line 540, in render_report_stage_map
    graph = map_full_svg(manager)
  File "/Users/dillon/miniconda3/envs/curifactory-dev/lib/python3.9/site-packages/curifactory/reporting.py", line 933, in map_full_svg
    _add_record_subgraph(dot, index, record, manager, detailed)
  File "/Users/dillon/miniconda3/envs/curifactory-dev/lib/python3.9/site-packages/curifactory/reporting.py", line 696, in _add_record_subgraph
    if artifact.init_record == record:
AttributeError: 'MapArtifactRepresentation' object has no attribute 'init_record'

Expected behavior
If the report has already been generated, I think I would expect to not generate a second identical one?

@WarmCyan
Copy link
Collaborator

WarmCyan commented Oct 3, 2023

Huh, I think this is actually because it's trying to generate the report while in map mode, I'll need to add a check for that in the various generation functions, although it's a good point that I should also add a flag to avoid a duplicate generation if run in non-dag mode or once mapping has completed.

@WarmCyan WarmCyan added the bug Something isn't working label Oct 3, 2023
@WarmCyan WarmCyan added this to Next in Roadmap Oct 3, 2023
@WarmCyan WarmCyan moved this from Next to WIP in Roadmap Oct 4, 2023
@WarmCyan WarmCyan moved this from WIP to Done in Roadmap Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

2 participants