-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from SebastianScherer88/recursive-non-null-dic…
…t-func Recursive non null dict func
- Loading branch information
Showing
7 changed files
with
135 additions
and
50 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
Empty file.
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,48 @@ | ||
import os | ||
|
||
from bettmensch_ai.server import RegisteredFlow | ||
|
||
|
||
def test_flow_from_hera_artifact_workflow_model( | ||
test_output_dir, | ||
test_hera_artifact_workflow_model, | ||
): | ||
|
||
test_artifact_flow = RegisteredFlow.from_hera_workflow_model( | ||
test_hera_artifact_workflow_model | ||
) | ||
|
||
with open( | ||
os.path.join(test_output_dir, "test-artifact-server-flow.json"), "w" | ||
) as file: | ||
file.write(test_artifact_flow.model_dump_json()) | ||
|
||
|
||
def test_flow_from_hera_parameter_workflow_model( | ||
test_output_dir, | ||
test_hera_parameter_workflow_model, | ||
): | ||
|
||
test_parameter_flow = RegisteredFlow.from_hera_workflow_model( | ||
test_hera_parameter_workflow_model | ||
) | ||
|
||
with open( | ||
os.path.join(test_output_dir, "test-parameter-server-flow.json"), "w" | ||
) as file: | ||
file.write(test_parameter_flow.model_dump_json()) | ||
|
||
|
||
def test_flow_from_hera_torch_gpu_workflow_model( | ||
test_output_dir, | ||
test_hera_torch_gpu_workflow_model, | ||
): | ||
|
||
test_torch_gpu_flow = RegisteredFlow.from_hera_workflow_model( | ||
test_hera_torch_gpu_workflow_model | ||
) | ||
|
||
with open( | ||
os.path.join(test_output_dir, "test-torch-gpu-server-flow.json"), "w" | ||
) as file: | ||
file.write(test_torch_gpu_flow.model_dump_json()) |
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,57 @@ | ||
import os | ||
|
||
from bettmensch_ai.server import RegisteredPipeline | ||
|
||
|
||
def test_pipeline_from_hera_artifact_workflow_template_model( | ||
test_output_dir, | ||
test_hera_artifact_workflow_template_model, | ||
): | ||
|
||
test_artifact_pipeline = ( | ||
RegisteredPipeline.from_hera_workflow_template_model( | ||
test_hera_artifact_workflow_template_model | ||
) | ||
) | ||
|
||
with open( | ||
os.path.join(test_output_dir, "test-artifact-server-pipeline.json"), | ||
"w", | ||
) as file: | ||
file.write(test_artifact_pipeline.model_dump_json()) | ||
|
||
|
||
def test_pipeline_from_hera_parameter_workflow_template_model( | ||
test_output_dir, | ||
test_hera_parameter_workflow_template_model, | ||
): | ||
|
||
test_parameter_pipeline = ( | ||
RegisteredPipeline.from_hera_workflow_template_model( | ||
test_hera_parameter_workflow_template_model | ||
) | ||
) | ||
|
||
with open( | ||
os.path.join(test_output_dir, "test-parameter-server-pipeline.json"), | ||
"w", | ||
) as file: | ||
file.write(test_parameter_pipeline.model_dump_json()) | ||
|
||
|
||
def test_pipeline_from_hera_torch_gpu_workflow_template_model( | ||
test_output_dir, | ||
test_hera_torch_gpu_workflow_template_model, | ||
): | ||
|
||
test_torch_gpu_pipeline = ( | ||
RegisteredPipeline.from_hera_workflow_template_model( | ||
test_hera_torch_gpu_workflow_template_model | ||
) | ||
) | ||
|
||
with open( | ||
os.path.join(test_output_dir, "test-torch-gpu-server-pipeline.json"), | ||
"w", | ||
) as file: | ||
file.write(test_torch_gpu_pipeline.model_dump_json()) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from bettmensch_ai.server.utils import copy_non_null_dict | ||
|
||
|
||
def test_copy_non_null_dict(): | ||
|
||
test_dict = { | ||
"a": None, | ||
"b": 2, | ||
"c": {"d": None, "e": 5, "f": {"g": None, "h": 8}}, | ||
} | ||
|
||
non_null_dict = copy_non_null_dict(test_dict) | ||
|
||
assert non_null_dict == {"b": 2, "c": {"e": 5, "f": {"h": 8}}} |