-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Samhita Alla <[email protected]>
- Loading branch information
1 parent
3bf2d1b
commit fbcab15
Showing
7 changed files
with
156 additions
and
56 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
examples/advanced_composition/advanced_composition/chain_entities.py | ||
examples/advanced_composition/advanced_composition/conditions.py | ||
examples/advanced_composition/advanced_composition/decorating_tasks.py | ||
examples/advanced_composition/advanced_composition/decorating_workflows.py | ||
examples/advanced_composition/advanced_composition/dynamics.py | ||
examples/advanced_composition/advanced_composition/map_task.py | ||
examples/advanced_composition/advanced_composition/waiting_for_external_inputs.py | ||
examples/basics/basics/documenting_workflows.py | ||
examples/basics/basics/hello_world.py | ||
examples/basics/basics/named_outputs.py | ||
examples/basics/basics/shell_task.py | ||
examples/basics/basics/workflow.py | ||
examples/data_types_and_io/data_types_and_io/dataclass.py | ||
examples/data_types_and_io/data_types_and_io/enum_type.py | ||
examples/data_types_and_io/data_types_and_io/file.py | ||
examples/data_types_and_io/data_types_and_io/folder.py | ||
examples/data_types_and_io/data_types_and_io/structured_dataset.py |
This file was deleted.
Oops, something went wrong.
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,60 @@ | ||
import json | ||
import os | ||
import subprocess | ||
import re | ||
|
||
file_list = "flyte_tests.txt" | ||
|
||
with open("flyte_tests_manifest.json", "r") as file: | ||
data = json.load(file) | ||
|
||
examples = [(example[0], example[1]) for entry in data for example in entry.get("examples", []) if len(example) >= 1] | ||
|
||
for file_name in open(file_list, "r").readlines(): | ||
file_name = file_name.strip() | ||
print(f"Processing file: {file_name}") | ||
|
||
# Retrieve the file path, including the name of the file and its immediate parent directory | ||
directory_path = os.path.dirname(file_name).split(os.path.sep)[-1:] | ||
file_path = ".".join(directory_path + [os.path.splitext(os.path.basename(file_name))[0]]) | ||
|
||
# Verify if there are any workflows present in the provided file path | ||
workflows = [] | ||
for workflow, params in examples: | ||
if file_path in workflow: | ||
workflows.append((workflow, params)) | ||
else: | ||
raise Exception("No workflows are defined in the given file.") | ||
|
||
for workflow, params in workflows: | ||
# Use the `pyflyte run` command to execute the workflow | ||
output_string = subprocess.run(["pyflyte", "run", file_name], capture_output=True, text=True).stdout | ||
|
||
# Define a regular expression pattern to match tasks/workflows in the pyflyte run output | ||
pattern = re.compile(r"^\│\s+(\w+)\s+", re.MULTILINE) | ||
|
||
# Extract command names using the specified pattern | ||
commands = re.findall(pattern, output_string) | ||
|
||
# Check if the workflow specified is present in the pyflyte run output | ||
just_the_workflow = workflow.split(".")[2] | ||
if just_the_workflow in commands: | ||
print("Workflow found in the pyflyte run output!") | ||
else: | ||
raise Exception("Workflow not found in the pyflyte run output.") | ||
|
||
# Check if the specified parameters are valid | ||
options_output = subprocess.run( | ||
["pyflyte", "run", file_name, just_the_workflow, "--help"], capture_output=True, text=True | ||
).stdout | ||
|
||
# Find all matches in the input string | ||
options = [option.replace("--", "") for option in re.compile(r"--\w+").findall(options_output)] | ||
|
||
# Validate if the provided params are a subset of the supported params | ||
if set(params).issubset(set(options)): | ||
print("All parameters found!") | ||
else: | ||
raise Exception( | ||
f"There's a mismatch between the values accepted by the workflow and the ones you provided." | ||
) |