job_default_config.py 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #
  2. # Copyright 2019 The FATE Authors. All Rights Reserved.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. #
  16. from fate_arch.common import file_utils
  17. from fate_flow.settings import FATE_FLOW_JOB_DEFAULT_CONFIG_PATH, stat_logger
  18. from .reload_config_base import ReloadConfigBase
  19. class JobDefaultConfig(ReloadConfigBase):
  20. # component provider
  21. default_component_provider_path = None
  22. # Resource
  23. total_cores_overweight_percent = None
  24. total_memory_overweight_percent = None
  25. task_parallelism = None
  26. task_cores = None
  27. task_memory = None
  28. max_cores_percent_per_job = None
  29. # scheduling
  30. remote_request_timeout = None
  31. federated_command_trys = None
  32. job_timeout = None
  33. end_status_job_scheduling_time_limit = None
  34. end_status_job_scheduling_updates = None
  35. auto_retries = None
  36. auto_retry_delay = None
  37. federated_status_collect_type = None
  38. detect_connect_max_retry_count = None
  39. detect_connect_long_retry_count = None
  40. # upload
  41. upload_block_max_bytes = None # bytes
  42. # component output
  43. output_data_summary_count_limit = None
  44. @classmethod
  45. def load(cls):
  46. conf = file_utils.load_yaml_conf(FATE_FLOW_JOB_DEFAULT_CONFIG_PATH)
  47. if not isinstance(conf, dict):
  48. raise ValueError("invalid config file")
  49. for k, v in conf.items():
  50. if hasattr(cls, k):
  51. setattr(cls, k, v)
  52. else:
  53. stat_logger.warning(f"job default config not supported {k}")
  54. return cls.get_all()