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

Remove the possibility for multiple Steps in a Realization, remove Stage #6313

Merged
merged 4 commits into from
Oct 24, 2023

Conversation

berland
Copy link
Contributor

@berland berland commented Oct 12, 2023

Step "id" is removed, as there is now only one step (the "zero" step).

Issue
Partially resolves #6218

Approach
✂️ and removing the Step layer in several tree structures.

Pre review checklist

  • Read through the code changes carefully after finishing work
  • Make sure tests pass locally (after every commit!)
  • Prepare changes in small commits for more convenient review (optional)
  • PR title captures the intent of the changes, and is fitting for release notes.
  • Updated documentation
  • Ensured that unit tests are added for all new behavior (See
    Ground Rules),
    and changes to existing code have good test coverage.

Pre merge checklist

  • Added appropriate release note label
  • Commit history is consistent and clean, in line with the contribution guidelines.

@berland berland force-pushed the remove_multistep branch 2 times, most recently from eb193e1 to 3c41825 Compare October 16, 2023 07:41
@berland berland marked this pull request as ready for review October 18, 2023 07:04
@berland berland marked this pull request as draft October 18, 2023 07:04
@berland berland marked this pull request as ready for review October 19, 2023 12:32
@berland berland self-assigned this Oct 19, 2023
@berland berland added maintenance Not a bug now but could be one day, repaying technical debt release-notes:maintenance Automatically categorise as maintenance change in release notes labels Oct 19, 2023
@berland berland changed the title Remove the possibility for multiple Steps in a Realization Remove the possibility for multiple Steps in a Realization, remove Stage Oct 19, 2023
@berland berland force-pushed the remove_multistep branch 5 times, most recently from 2c8ddb1 to 7e65644 Compare October 20, 2023 07:58
@codecov-commenter

This comment was marked as resolved.

@berland berland force-pushed the remove_multistep branch 3 times, most recently from faf8b06 to c66be59 Compare October 20, 2023 10:27
@@ -121,13 +119,13 @@ def prerender(
metadata[SORTED_REALIZATION_IDS] = sorted(snapshot.reals.keys(), key=int)
metadata[SORTED_JOB_IDS] = defaultdict(dict)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you can do:

metadata[SORTED_JOB_IDS] = defaultdict(lambda: defaultdict(list))
 for idx, _ in job_states.items():
      real_id, job_id = idx
      metadata[SORTED_JOB_IDS][real_id].append(job_id)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With some modifications, done. Nice.

@@ -487,10 +461,12 @@ def index(self, row: int, column: int, parent: QModelIndex = None) -> QModelInde
if parent is None:
parent = QModelIndex()
if not self.hasIndex(row, column, parent):
# we end here when parent is real_index, that is wrong!!!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can remove these comments now :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✂️

def _shouldFailJob(self, real, step, job):
return (real, 0, step, job) in self.fail_jobs
def _shouldFailJob(self, real, job):
return (real, 0, job) in self.fail_jobs
Copy link
Contributor

@xjules xjules Oct 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the second parameter 0 - can we remove it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats probably a step that we should remove. Nice catch!

@@ -194,11 +184,11 @@ def evaluate(self, config):
def start(self):
self._eval_thread.start()

def _shouldFailJob(self, real, step, job):
return (real, 0, step, job) in self.fail_jobs
def _shouldFailJob(self, real, job):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is used only once, so I think it can be inlined instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this self.fail_jobs list is never updated so the if-sentence using this is probably never hit. This is potentially something unfinished in the test code, and fixing it or removing it should be its own PR.


def addFailJob(self, real, step, job):
self.fail_jobs.append((real, 0, step, job))
def addFailJob(self, real, job):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✂️ - not in use.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xjules
Copy link
Contributor

xjules commented Oct 24, 2023

One thing that I would include is a small comment (a paragraph perhaps?) explaining what's the purpose of this Step singleton under the realization.

Step "id" is removed, as there is now only one step (the "zero" step).
The step is kept for now as it contains needed information for how to
run the realization. This information is later to be merged upwards to
the realization itself.
@berland
Copy link
Contributor Author

berland commented Oct 24, 2023

One thing that I would include is a small comment (a paragraph perhaps?) explaining what's the purpose of this Step singleton under the realization.

Added a sentence in the git commit log. Looking at the source I find it readable due to the dataclass structure.

Copy link
Contributor

@xjules xjules left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing job @berland ! 🚀

@berland berland merged commit b100fb3 into equinor:main Oct 24, 2023
44 checks passed
@berland berland deleted the remove_multistep branch November 8, 2023 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Not a bug now but could be one day, repaying technical debt release-notes:maintenance Automatically categorise as maintenance change in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove Stage, Step and Job from ensemble_evaluator._builder
3 participants