Skip to content

Conversation

@yonitoo
Copy link
Contributor

@yonitoo yonitoo commented Mar 27, 2023

Introduce a DagValidator class that properly validates the Meta Jobs DAG before it is built. It checks for:

  • DAG structure (spelling mistakes, all the types of the job dict keys)
  • duplicate jobs
  • DAG cycles

Rework the test_meta_job tests by introducing a TestMetaJob class that contains all the existing ones as well as some new validation-related ones.

Tested-by: all the existing tests pass and introduced some new unit tests for the different cases

Signed-off-by: Yoan Salambashev ysalambashev@vmware.com

yonitoo added 2 commits March 27, 2023 16:11
Signed-off-by: Yoan Salambashev <ysalambashev@vmware.com>
Signed-off-by: Yoan Salambashev <ysalambashev@vmware.com>
Copy link
Contributor

@gabrielgeorgiev1 gabrielgeorgiev1 left a comment

Choose a reason for hiding this comment

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

looks good overall, I'm approving it but I'd still appreciate responses for my comments

Copy link
Contributor

@antoniivanov antoniivanov left a comment

Choose a reason for hiding this comment

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

In addition to checking for job structure, there are a few other validations you may want to consider on DAG level . (if you are planning to add them in separate PR , then you can ignore this comment)

  1. Validate that there are not cycles
  2. As the DAG is a list of jobs it's possible to have duplicate job names. This can lead to confusion and unintended behavior

You can use graphlib.TopologicalSorter for that (at least for 1.)

@yonitoo
Copy link
Contributor Author

yonitoo commented Mar 29, 2023

Added 2 new classes:

  • DagValidator: the validation logic is moved there
  • TestMetaJob: cleaned up the mess around test_meta_job unit tests

The only thing left to be done now is to add topological sorter validation.
@tozka 2. is handled by the check that checks for already validated jobs but will also be handled by the topo sorter (I think so)

Signed-off-by: Yoan Salambashev <ysalambashev@vmware.com>
Copy link
Contributor

@antoniivanov antoniivanov left a comment

Choose a reason for hiding this comment

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

Functionality looks pretty good. I have mostly clean code suggestion.

@yonitoo yonitoo requested a review from antoniivanov March 30, 2023 11:37
Copy link
Contributor

@antoniivanov antoniivanov left a comment

Choose a reason for hiding this comment

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

LGTM.

Please go over the message description. Make sure they are clear to someone without context . They know what the problem is and how to solve it.

yonitoo and others added 2 commits March 30, 2023 14:52
Signed-off-by: Yoan Salambashev <ysalambashev@vmware.com>
@yonitoo yonitoo enabled auto-merge (squash) March 30, 2023 12:02
@yonitoo yonitoo disabled auto-merge March 30, 2023 12:03
Signed-off-by: Yoan Salambashev <ysalambashev@vmware.com>
@yonitoo yonitoo enabled auto-merge (squash) March 30, 2023 13:08
@yonitoo yonitoo disabled auto-merge March 30, 2023 13:08
@yonitoo yonitoo enabled auto-merge (squash) March 30, 2023 13:10
@gabrielgeorgiev1 gabrielgeorgiev1 enabled auto-merge (squash) March 30, 2023 14:26
@gabrielgeorgiev1 gabrielgeorgiev1 merged commit 9b742e3 into main Mar 30, 2023
@gabrielgeorgiev1 gabrielgeorgiev1 deleted the person/ysalambashev/meta-jobs-validation branch March 30, 2023 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants