(project_name, api_key)
| 787 | |
| 788 | |
| 789 | def 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 | |
| 818 | def create_run(project_id, api_key, run_name=None): |
no test coverage detected