Skip to content

tests: serialize pipeline file #3985

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

Merged
merged 1 commit into from
Jun 9, 2020

Conversation

skshetry
Copy link
Collaborator

@skshetry skshetry commented Jun 9, 2020

This PR adds sorting for params keys as well. Before, it was only getting sorted for lockfile.
Rest are tests and a bit of refactoring that does not change anything.

  • ❗ I have followed the Contributing to DVC checklist.

  • 📖 If this PR requires documentation updates, I have created a separate PR (or issue, at least) in dvc.org and linked it here. If the CLI API is changed, I have updated tab completion scripts.

  • ❌ I will check DeepSource, CodeClimate, and other sanity checks below. (We consider them recommendatory and don't expect everything to be addressed. Please fix things that actually improve code or fix bugs.)

Thank you for the contribution - we'll try to review it as soon as possible. 🙏

Part of #3693

serialize: make params ordered
@skshetry skshetry added refactoring Factoring and re-factoring testing Related to the tests and the testing infrastructure labels Jun 9, 2020
@skshetry skshetry requested review from pmrowla, efiop and pared June 9, 2020 07:06
@skshetry skshetry self-assigned this Jun 9, 2020
@@ -70,16 +82,15 @@ def _serialize_params(params: List[ParamsDependency]):
dump = param_dep.dumpd()
path, params = dump[PARAM_PATH], dump[PARAM_PARAMS]
if isinstance(params, dict):
k = list(params.keys())
k = sorted(params.keys())
Copy link
Collaborator Author

@skshetry skshetry Jun 9, 2020

Choose a reason for hiding this comment

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

Before, we were not sorting params keys for pipeline file before, only for the lock.

[("plots", {"plot": True}), ("metrics", {"metric": True}), ("outs", {})],
)
def test_outs_and_outs_flags_are_sorted(dvc, typ, extra):
stage = create_stage(PipelineStage, dvc, deps=["input"], **kwargs)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe, we should implement {metrics,plots}[_persist][_no_cache] that are missing?

Copy link
Contributor

Choose a reason for hiding this comment

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

@skshetry Could you elaborate?

Copy link
Collaborator Author

@skshetry skshetry Jun 9, 2020

Choose a reason for hiding this comment

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

On .dvc and dvc.yaml files, we allow metrics and plots to be cache: False and persist: True. But, it cannot be set from outside (eg: fill_stage_outputs and dvc run). So, I was just saying that maybe we should implement that for run as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

@skshetry Let's not create those dvc run options for now, it is crowded there as it is. We clearly need to consider a different CLI approach, as metrics_persist_no_cache is just too ugly and doesn't scale if we introduce yet another option 🙂 We've been discussing something like using a comma to join those fstab-style, but, again, not worth bothering with that for now.

@efiop
Copy link
Contributor

efiop commented Jun 9, 2020

For the record: snap is failing for unrelated reasons.

@efiop efiop merged commit d201fad into iterative:master Jun 9, 2020
@skshetry skshetry deleted the tests-serialize-pipeline-file branch June 9, 2020 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Factoring and re-factoring testing Related to the tests and the testing infrastructure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants