mirror of
https://github.com/vale981/ray
synced 2025-03-05 18:11:42 -05:00
[workflow] fix workflow user metadata return when None is given (#19356)
## Why are these changes needed? Quick fix for metadata put. Currently when workflow-level metadata is not given, it will output `null` to `user_run_metadata.json`, this fix will make it output `{}`. ## Related issue number original issue: https://github.com/ray-project/ray/issues/17090 original PR: https://github.com/ray-project/ray/pull/19195
This commit is contained in:
parent
1dc03cd49d
commit
b86a5fcb96
2 changed files with 20 additions and 0 deletions
|
@ -37,6 +37,7 @@ def run(entry_workflow: Workflow,
|
|||
raise ValueError("metadata values must be JSON serializable, "
|
||||
"however '{}' has a value whose {}.".format(
|
||||
k, e))
|
||||
metadata = metadata or {}
|
||||
|
||||
store = get_global_storage()
|
||||
assert ray.is_initialized()
|
||||
|
|
|
@ -86,6 +86,25 @@ def test_workflow_runtime_metadata(workflow_start_regular):
|
|||
assert "end_time" in postrun_meta
|
||||
|
||||
|
||||
def test_no_user_metadata(workflow_start_regular):
|
||||
|
||||
workflow_id = "simple"
|
||||
step_name = "simple_step"
|
||||
|
||||
@workflow.step(name=step_name)
|
||||
def simple():
|
||||
return 0
|
||||
|
||||
simple.step().run(workflow_id)
|
||||
|
||||
checkpointed_user_step_metadata = get_metadata(
|
||||
[workflow_id, "steps", step_name, workflow_storage.STEP_USER_METADATA])
|
||||
checkpointed_user_run_metadata = get_metadata(
|
||||
[workflow_id, workflow_storage.WORKFLOW_USER_METADATA])
|
||||
assert {} == checkpointed_user_step_metadata
|
||||
assert {} == checkpointed_user_run_metadata
|
||||
|
||||
|
||||
def test_all_metadata(workflow_start_regular):
|
||||
|
||||
user_step_metadata = {"k1": "v1"}
|
||||
|
|
Loading…
Add table
Reference in a new issue