Skip to content

Commit

Permalink
task conf: json to yaml
Browse files Browse the repository at this point in the history
Signed-off-by: Jat <jat@sinosky.org>
  • Loading branch information
jat001 committed Jan 17, 2023
1 parent 3f0ea5e commit 73ad253
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions python/fate/components/entrypoint/component_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ def _set(v):


def load_config_from_file(configs, config_file):
import json
from ruamel import yaml

if config_file is not None:
configs.update(json.load(config_file))
configs.update(yaml.safe_load(config_file))
return configs


Expand All @@ -138,10 +138,10 @@ def load_config_from_entrypoint(configs, config_entrypoint):

def load_config_from_env(configs, env_name):
import os
import json
from ruamel import yaml

if env_name is not None and os.environ.get(env_name):
configs.update(json.loads(os.environ[env_name]))
configs.update(yaml.safe_load(os.environ[env_name]))
return configs


Expand Down
3 changes: 2 additions & 1 deletion python/fate/components/loader/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import tempfile
from datetime import datetime

from ruamel import yaml

from fate.components.spec.model import (
MLModelComponentSpec,
MLModelFederatedSpec,
Expand All @@ -26,7 +28,6 @@
MLModelPartySpec,
MLModelSpec,
)
from ruamel import yaml


def load_output_model_wrapper(task_id, party_task_id, cpn, role, partyid, federation):
Expand Down

0 comments on commit 73ad253

Please sign in to comment.