MCPcopy
hub / github.com/FedML-AI/FedML / create_project

Function create_project

python/fedml/core/mlops/__init__.py:789–815  ·  view source on GitHub ↗
(project_name, api_key)

Source from the content-addressed store, hash-verified

787
788
789def create_project(project_name, api_key):
790 url_prefix, cert_path = get_request_params(MLOpsStore.mlops_args)
791 url = "{}/fedmlOpsServer/projects/createSim".format(url_prefix)
792 json_params = {"name": project_name,
793 "userids": api_key,
794 "platform_type": str(FEDML_TRAINING_PLATFORM_SIMULATION_TYPE)}
795 if cert_path is not None:
796 try:
797 requests.session().verify = cert_path
798 response = requests.post(
799 url, json=json_params, verify=True, headers={"content-type": "application/json", "Connection": "close"}
800 )
801 except requests.exceptions.SSLError as err:
802 MLOpsConfigs.install_root_ca_file()
803 response = requests.post(
804 url, json=json_params, verify=True, headers={"content-type": "application/json", "Connection": "close"}
805 )
806 else:
807 response = requests.post(
808 url, json=json_params, headers={"Connection": "close"}
809 )
810 status_code = response.json().get("code")
811 if status_code == FEDML_MLOPS_API_RESPONSE_SUCCESS_CODE:
812 project_id = response.json().get("data")
813 return True, project_id
814 else:
815 return False, 0
816
817
818def create_run(project_id, api_key, run_name=None):

Callers 1

initFunction · 0.85

Calls 3

get_request_paramsFunction · 0.85
install_root_ca_fileMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected