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

Function create_run

python/fedml/core/mlops/__init__.py:818–848  ·  view source on GitHub ↗
(project_id, api_key, run_name=None)

Source from the content-addressed store, hash-verified

816
817
818def create_run(project_id, api_key, run_name=None):
819 url_prefix, cert_path = get_request_params(MLOpsStore.mlops_args)
820 url = "{}/fedmlOpsServer/runs/createSim".format(url_prefix)
821 edge_ids = list()
822 edge_ids.append(MLOpsStore.mlops_edge_id)
823 json_params = {"userids": api_key,
824 "projectid": str(project_id),
825 "edgeids": edge_ids}
826 if run_name is not None:
827 json_params["name"] = run_name
828 if cert_path is not None:
829 try:
830 requests.session().verify = cert_path
831 response = requests.post(
832 url, json=json_params, verify=True, headers={"content-type": "application/json", "Connection": "close"}
833 )
834 except requests.exceptions.SSLError as err:
835 MLOpsConfigs.install_root_ca_file()
836 response = requests.post(
837 url, json=json_params, verify=True, headers={"content-type": "application/json", "Connection": "close"}
838 )
839 else:
840 response = requests.post(
841 url, json=json_params, headers={"Connection": "close"}
842 )
843 status_code = response.json().get("code")
844 if status_code == FEDML_MLOPS_API_RESPONSE_SUCCESS_CODE:
845 run_id = response.json().get("data")
846 return True, run_id
847 else:
848 return False, 0
849
850
851def get_request_params(args):

Callers 1

initFunction · 0.70

Calls 3

get_request_paramsFunction · 0.85
install_root_ca_fileMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected