-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: improve error handling and messages for partitioning patter…
…ns (#46) * refactor: improve error handling and messages for partitioning patterns * fix: typo in error message * fix: remove unnecessary validation in local runtime * test: add test coverage and errors for 2 other common partitioning mistakes
- Loading branch information
Showing
10 changed files
with
162 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""CLI utility to dump the manifest for a specific example.""" | ||
|
||
from typing import List | ||
|
||
import yaml | ||
|
||
from dagger import DAG | ||
from dagger.runtime.argo import Metadata, Workflow, workflow_manifest | ||
|
||
|
||
def dump_argo_manifest(dag: DAG, example_name: str): | ||
"""Generate a workflow manifest from the supplied DAG and dump it as a YAML file into tests/examples/argo/.""" | ||
manifest = _generate_manifest( | ||
dag, | ||
name=example_name.replace("_", "-"), | ||
entrypoint=["python", f"examples/{example_name}.py"], | ||
) | ||
|
||
with open(f"tests/examples/argo/{example_name}.yaml", "w") as f: | ||
yaml.safe_dump(manifest, f) | ||
|
||
|
||
def _generate_manifest(dag: DAG, name: str, entrypoint: List[str]): | ||
metadata = Metadata( | ||
name=name, | ||
generate_name_from_prefix=True, | ||
) | ||
workflow = Workflow( | ||
container_image="local.registry/dagger", | ||
container_entrypoint_to_dag_cli=entrypoint, | ||
) | ||
return workflow_manifest(dag, metadata=metadata, workflow=workflow) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters