materialsproject / jobflow

jobflow is a library for writing computational workflows.
https://materialsproject.github.io/jobflow
Other
90 stars 24 forks source link

Simplify code by using `Flow` methods `__len__` and `__getitem__` #467

Closed janosh closed 10 months ago

janosh commented 10 months ago

Saves accessing flow.jobs a bunch.

codecov[bot] commented 10 months ago

Codecov Report

Merging #467 (7c66385) into main (85aabc5) will not change coverage. Report is 1 commits behind head on main. The diff coverage is 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #467 +/- ## ======================================= Coverage 99.86% 99.86% ======================================= Files 20 20 Lines 1516 1516 Branches 419 419 ======================================= Hits 1514 1514 Misses 2 2 ``` | [Files](https://app.codecov.io/gh/materialsproject/jobflow/pull/467?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=materialsproject) | Coverage Δ | | |---|---|---| | [src/jobflow/core/flow.py](https://app.codecov.io/gh/materialsproject/jobflow/pull/467?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=materialsproject#diff-c3JjL2pvYmZsb3cvY29yZS9mbG93LnB5) | `100.00% <100.00%> (ø)` | | | [src/jobflow/utils/graph.py](https://app.codecov.io/gh/materialsproject/jobflow/pull/467?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=materialsproject#diff-c3JjL2pvYmZsb3cvdXRpbHMvZ3JhcGgucHk=) | `100.00% <100.00%> (ø)` | |
utf commented 10 months ago

Hi @janosh, please could you revert this change, since it overlaps with the __getitem__ stuff proposed in #450. The __len__ part should still be fine.

At some point, we will need to rewrite the __getitem__ stuff in Flow and so with this PR we'd have to rewrite all the tests too.

janosh commented 10 months ago

could you specify what you mean by "have to rewrite the Flow.getitem"? do you want to make it behave like a dict rather than a list of jobs?