From 79937691aef53d00738340ac7883947ded10539e Mon Sep 17 00:00:00 2001 From: VsevolodX Date: Thu, 19 Feb 2026 17:31:56 -0800 Subject: [PATCH 1/2] update: use new clusters api --- .../workflows/band_gap.ipynb | 133 ++++++++++++------ pyproject.toml | 2 +- 2 files changed, 88 insertions(+), 47 deletions(-) diff --git a/other/materials_designer/workflows/band_gap.ipynb b/other/materials_designer/workflows/band_gap.ipynb index f91f3873..7162e617 100644 --- a/other/materials_designer/workflows/band_gap.ipynb +++ b/other/materials_designer/workflows/band_gap.ipynb @@ -100,6 +100,26 @@ "id": "5", "metadata": {}, "outputs": [], + "source": [ + "import os\n", + "\n", + "os.environ[\"API_HOST\"] = \"localhost\"\n", + "os.environ[\"API_PORT\"] = \"3000\"\n", + "os.environ[\"API_SECURE\"] = \"false\"\n", + "\n", + "\n", + "API_HOST = \"localhost\"\n", + "API_PORT = \"3000\"\n", + "API_SECURE = \"false\"\n", + "API_VERSION = \"2018-10-01\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6", + "metadata": {}, + "outputs": [], "source": [ "from utils.auth import authenticate\n", "\n", @@ -109,7 +129,7 @@ }, { "cell_type": "markdown", - "id": "6", + "id": "7", "metadata": {}, "source": [ "### 2.2. Initialize API client\n", @@ -119,7 +139,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7", + "id": "8", "metadata": {}, "outputs": [], "source": [ @@ -130,7 +150,7 @@ }, { "cell_type": "markdown", - "id": "8", + "id": "9", "metadata": {}, "source": [ "### 2.3. Select account to work under\n", @@ -140,7 +160,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9", + "id": "10", "metadata": {}, "outputs": [], "source": [ @@ -150,7 +170,7 @@ { "cell_type": "code", "execution_count": null, - "id": "10", + "id": "11", "metadata": {}, "outputs": [], "source": [ @@ -165,7 +185,7 @@ }, { "cell_type": "markdown", - "id": "11", + "id": "12", "metadata": {}, "source": [ "## 3. Create material\n", @@ -175,7 +195,7 @@ { "cell_type": "code", "execution_count": null, - "id": "12", + "id": "13", "metadata": {}, "outputs": [], "source": [ @@ -192,7 +212,7 @@ }, { "cell_type": "markdown", - "id": "13", + "id": "14", "metadata": {}, "source": [ "### 3.2. Save material to the platform" @@ -201,7 +221,7 @@ { "cell_type": "code", "execution_count": null, - "id": "14", + "id": "15", "metadata": {}, "outputs": [], "source": [ @@ -215,7 +235,7 @@ }, { "cell_type": "markdown", - "id": "15", + "id": "16", "metadata": { "tags": [] }, @@ -226,7 +246,7 @@ { "cell_type": "code", "execution_count": null, - "id": "16", + "id": "17", "metadata": {}, "outputs": [], "source": [ @@ -235,7 +255,7 @@ }, { "cell_type": "markdown", - "id": "17", + "id": "18", "metadata": {}, "source": [ "## 5. Create workflow and set its parameters\n", @@ -245,7 +265,7 @@ { "cell_type": "code", "execution_count": null, - "id": "18", + "id": "19", "metadata": {}, "outputs": [], "source": [ @@ -258,7 +278,7 @@ { "cell_type": "code", "execution_count": null, - "id": "19", + "id": "20", "metadata": {}, "outputs": [], "source": [ @@ -269,7 +289,7 @@ }, { "cell_type": "markdown", - "id": "20", + "id": "21", "metadata": {}, "source": [ "### 5.2. Create workflow from standard workflows and preview it" @@ -278,7 +298,7 @@ { "cell_type": "code", "execution_count": null, - "id": "21", + "id": "22", "metadata": {}, "outputs": [], "source": [ @@ -294,7 +314,7 @@ }, { "cell_type": "markdown", - "id": "22", + "id": "23", "metadata": {}, "source": [ "### 5.3. Add relaxation subworkflow" @@ -303,7 +323,7 @@ { "cell_type": "code", "execution_count": null, - "id": "23", + "id": "24", "metadata": {}, "outputs": [], "source": [ @@ -317,7 +337,7 @@ }, { "cell_type": "markdown", - "id": "24", + "id": "25", "metadata": {}, "source": [ "### 5.4. Change subworkflow details (Model subtype)\n", @@ -327,7 +347,7 @@ { "cell_type": "code", "execution_count": null, - "id": "25", + "id": "26", "metadata": {}, "outputs": [], "source": [ @@ -340,7 +360,7 @@ }, { "cell_type": "markdown", - "id": "26", + "id": "27", "metadata": {}, "source": [ "#### 5.4.2. Modify model in subworkflow units" @@ -349,7 +369,7 @@ { "cell_type": "code", "execution_count": null, - "id": "27", + "id": "28", "metadata": {}, "outputs": [], "source": [ @@ -379,7 +399,7 @@ }, { "cell_type": "markdown", - "id": "28", + "id": "29", "metadata": {}, "source": [ "### 5.5. Modify k-grid in subworkflow units\n", @@ -389,7 +409,7 @@ { "cell_type": "code", "execution_count": null, - "id": "29", + "id": "30", "metadata": {}, "outputs": [], "source": [ @@ -402,7 +422,7 @@ }, { "cell_type": "markdown", - "id": "30", + "id": "31", "metadata": {}, "source": [ "#### 5.5.3. Modify workflow units with new context" @@ -411,7 +431,7 @@ { "cell_type": "code", "execution_count": null, - "id": "31", + "id": "32", "metadata": {}, "outputs": [], "source": [ @@ -439,7 +459,7 @@ }, { "cell_type": "markdown", - "id": "32", + "id": "33", "metadata": {}, "source": [ "### 5.6. Save workflow to collection" @@ -448,7 +468,7 @@ { "cell_type": "code", "execution_count": null, - "id": "33", + "id": "34", "metadata": {}, "outputs": [], "source": [ @@ -462,31 +482,52 @@ }, { "cell_type": "markdown", - "id": "34", + "id": "35", "metadata": {}, "source": [ - "## 6. Create the compute configuration" + "## 6. Create the compute configuration\n", + "### 6.1. Get list of clusters" ] }, { "cell_type": "code", "execution_count": null, - "id": "35", + "id": "36", + "metadata": {}, + "outputs": [], + "source": [ + "clusters = client.clusters.list()" + ] + }, + { + "cell_type": "markdown", + "id": "37", + "metadata": {}, + "source": [ + "### 6.2. Create compute configuration for the job" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "38", "metadata": {}, "outputs": [], "source": [ - "from utils.api import get_cluster_name\n", + "from mat3ra.ide.compute import Compute, QueueName\n", "\n", - "CLUSTER_NAME = get_cluster_name()\n", + "cluster = clusters[0]\n", "\n", - "compute = client.jobs.build_compute_config(\n", - " cluster=CLUSTER_NAME\n", + "compute = Compute(\n", + " cluster=cluster,\n", + " queue=QueueName.D,\n", + " ppn=2\n", ")" ] }, { "cell_type": "markdown", - "id": "36", + "id": "39", "metadata": {}, "source": [ "## 7. Create the job with material and workflow configuration\n", @@ -496,7 +537,7 @@ { "cell_type": "code", "execution_count": null, - "id": "37", + "id": "40", "metadata": {}, "outputs": [], "source": [ @@ -506,7 +547,7 @@ }, { "cell_type": "markdown", - "id": "38", + "id": "41", "metadata": {}, "source": [ "### 7.2. Create job" @@ -515,7 +556,7 @@ { "cell_type": "code", "execution_count": null, - "id": "39", + "id": "42", "metadata": {}, "outputs": [], "source": [ @@ -533,7 +574,7 @@ " project_id=project_id,\n", " prefix=JOB_NAME,\n", " owner_id=ACCOUNT_ID,\n", - " compute=compute,\n", + " compute=compute.to_dict(),\n", ")\n", "\n", "job_dict = job_response[0]\n", @@ -545,7 +586,7 @@ }, { "cell_type": "markdown", - "id": "40", + "id": "43", "metadata": {}, "source": [ "## 8. Submit the job and monitor the status" @@ -554,7 +595,7 @@ { "cell_type": "code", "execution_count": null, - "id": "41", + "id": "44", "metadata": {}, "outputs": [], "source": [ @@ -564,7 +605,7 @@ { "cell_type": "code", "execution_count": null, - "id": "42", + "id": "45", "metadata": {}, "outputs": [], "source": [ @@ -575,7 +616,7 @@ }, { "cell_type": "markdown", - "id": "43", + "id": "46", "metadata": {}, "source": [ "## 9. Retrieve results" @@ -584,7 +625,7 @@ { "cell_type": "code", "execution_count": null, - "id": "44", + "id": "47", "metadata": {}, "outputs": [], "source": [ @@ -598,7 +639,7 @@ { "cell_type": "code", "execution_count": null, - "id": "45", + "id": "48", "metadata": {}, "outputs": [], "source": [] diff --git a/pyproject.toml b/pyproject.toml index 6d71bdfa..3fd1febd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ dependencies = [ # otherwise on 3.21.1 we encountered negative number of atoms during supercell generation "ase>=3.25.0", # Use a valid PEP 508 URL for a local file dependency: file URIs must be absolute and include three slashes - "mat3ra-api-client @ git+https://github.com/Exabyte-io/api-client.git@a329f363893ee96832b5c1a3c514ade28f0839cb", + "mat3ra-api-client @ git+https://github.com/Exabyte-io/api-client.git@141d7dba220f07844e97557dda3ee74087b38c31", "matplotlib>=3.4.1", "pandas>=1.5.3", "pymatgen==2024.4.13", From 42bc2e3a979a3ac913016ddbb5553196f0f59d8e Mon Sep 17 00:00:00 2001 From: VsevolodX Date: Thu, 19 Feb 2026 17:44:13 -0800 Subject: [PATCH 2/2] chore: remove dev --- .../workflows/band_gap.ipynb | 104 +++++++----------- 1 file changed, 42 insertions(+), 62 deletions(-) diff --git a/other/materials_designer/workflows/band_gap.ipynb b/other/materials_designer/workflows/band_gap.ipynb index 7162e617..a03f2a65 100644 --- a/other/materials_designer/workflows/band_gap.ipynb +++ b/other/materials_designer/workflows/band_gap.ipynb @@ -100,26 +100,6 @@ "id": "5", "metadata": {}, "outputs": [], - "source": [ - "import os\n", - "\n", - "os.environ[\"API_HOST\"] = \"localhost\"\n", - "os.environ[\"API_PORT\"] = \"3000\"\n", - "os.environ[\"API_SECURE\"] = \"false\"\n", - "\n", - "\n", - "API_HOST = \"localhost\"\n", - "API_PORT = \"3000\"\n", - "API_SECURE = \"false\"\n", - "API_VERSION = \"2018-10-01\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "6", - "metadata": {}, - "outputs": [], "source": [ "from utils.auth import authenticate\n", "\n", @@ -129,7 +109,7 @@ }, { "cell_type": "markdown", - "id": "7", + "id": "6", "metadata": {}, "source": [ "### 2.2. Initialize API client\n", @@ -139,7 +119,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8", + "id": "7", "metadata": {}, "outputs": [], "source": [ @@ -150,7 +130,7 @@ }, { "cell_type": "markdown", - "id": "9", + "id": "8", "metadata": {}, "source": [ "### 2.3. Select account to work under\n", @@ -160,7 +140,7 @@ { "cell_type": "code", "execution_count": null, - "id": "10", + "id": "9", "metadata": {}, "outputs": [], "source": [ @@ -170,7 +150,7 @@ { "cell_type": "code", "execution_count": null, - "id": "11", + "id": "10", "metadata": {}, "outputs": [], "source": [ @@ -185,7 +165,7 @@ }, { "cell_type": "markdown", - "id": "12", + "id": "11", "metadata": {}, "source": [ "## 3. Create material\n", @@ -195,7 +175,7 @@ { "cell_type": "code", "execution_count": null, - "id": "13", + "id": "12", "metadata": {}, "outputs": [], "source": [ @@ -212,7 +192,7 @@ }, { "cell_type": "markdown", - "id": "14", + "id": "13", "metadata": {}, "source": [ "### 3.2. Save material to the platform" @@ -221,7 +201,7 @@ { "cell_type": "code", "execution_count": null, - "id": "15", + "id": "14", "metadata": {}, "outputs": [], "source": [ @@ -235,7 +215,7 @@ }, { "cell_type": "markdown", - "id": "16", + "id": "15", "metadata": { "tags": [] }, @@ -246,7 +226,7 @@ { "cell_type": "code", "execution_count": null, - "id": "17", + "id": "16", "metadata": {}, "outputs": [], "source": [ @@ -255,7 +235,7 @@ }, { "cell_type": "markdown", - "id": "18", + "id": "17", "metadata": {}, "source": [ "## 5. Create workflow and set its parameters\n", @@ -265,7 +245,7 @@ { "cell_type": "code", "execution_count": null, - "id": "19", + "id": "18", "metadata": {}, "outputs": [], "source": [ @@ -278,7 +258,7 @@ { "cell_type": "code", "execution_count": null, - "id": "20", + "id": "19", "metadata": {}, "outputs": [], "source": [ @@ -289,7 +269,7 @@ }, { "cell_type": "markdown", - "id": "21", + "id": "20", "metadata": {}, "source": [ "### 5.2. Create workflow from standard workflows and preview it" @@ -298,7 +278,7 @@ { "cell_type": "code", "execution_count": null, - "id": "22", + "id": "21", "metadata": {}, "outputs": [], "source": [ @@ -314,7 +294,7 @@ }, { "cell_type": "markdown", - "id": "23", + "id": "22", "metadata": {}, "source": [ "### 5.3. Add relaxation subworkflow" @@ -323,7 +303,7 @@ { "cell_type": "code", "execution_count": null, - "id": "24", + "id": "23", "metadata": {}, "outputs": [], "source": [ @@ -337,7 +317,7 @@ }, { "cell_type": "markdown", - "id": "25", + "id": "24", "metadata": {}, "source": [ "### 5.4. Change subworkflow details (Model subtype)\n", @@ -347,7 +327,7 @@ { "cell_type": "code", "execution_count": null, - "id": "26", + "id": "25", "metadata": {}, "outputs": [], "source": [ @@ -360,7 +340,7 @@ }, { "cell_type": "markdown", - "id": "27", + "id": "26", "metadata": {}, "source": [ "#### 5.4.2. Modify model in subworkflow units" @@ -369,7 +349,7 @@ { "cell_type": "code", "execution_count": null, - "id": "28", + "id": "27", "metadata": {}, "outputs": [], "source": [ @@ -399,7 +379,7 @@ }, { "cell_type": "markdown", - "id": "29", + "id": "28", "metadata": {}, "source": [ "### 5.5. Modify k-grid in subworkflow units\n", @@ -409,7 +389,7 @@ { "cell_type": "code", "execution_count": null, - "id": "30", + "id": "29", "metadata": {}, "outputs": [], "source": [ @@ -422,7 +402,7 @@ }, { "cell_type": "markdown", - "id": "31", + "id": "30", "metadata": {}, "source": [ "#### 5.5.3. Modify workflow units with new context" @@ -431,7 +411,7 @@ { "cell_type": "code", "execution_count": null, - "id": "32", + "id": "31", "metadata": {}, "outputs": [], "source": [ @@ -459,7 +439,7 @@ }, { "cell_type": "markdown", - "id": "33", + "id": "32", "metadata": {}, "source": [ "### 5.6. Save workflow to collection" @@ -468,7 +448,7 @@ { "cell_type": "code", "execution_count": null, - "id": "34", + "id": "33", "metadata": {}, "outputs": [], "source": [ @@ -482,7 +462,7 @@ }, { "cell_type": "markdown", - "id": "35", + "id": "34", "metadata": {}, "source": [ "## 6. Create the compute configuration\n", @@ -492,7 +472,7 @@ { "cell_type": "code", "execution_count": null, - "id": "36", + "id": "35", "metadata": {}, "outputs": [], "source": [ @@ -501,7 +481,7 @@ }, { "cell_type": "markdown", - "id": "37", + "id": "36", "metadata": {}, "source": [ "### 6.2. Create compute configuration for the job" @@ -510,7 +490,7 @@ { "cell_type": "code", "execution_count": null, - "id": "38", + "id": "37", "metadata": {}, "outputs": [], "source": [ @@ -527,7 +507,7 @@ }, { "cell_type": "markdown", - "id": "39", + "id": "38", "metadata": {}, "source": [ "## 7. Create the job with material and workflow configuration\n", @@ -537,7 +517,7 @@ { "cell_type": "code", "execution_count": null, - "id": "40", + "id": "39", "metadata": {}, "outputs": [], "source": [ @@ -547,7 +527,7 @@ }, { "cell_type": "markdown", - "id": "41", + "id": "40", "metadata": {}, "source": [ "### 7.2. Create job" @@ -556,7 +536,7 @@ { "cell_type": "code", "execution_count": null, - "id": "42", + "id": "41", "metadata": {}, "outputs": [], "source": [ @@ -586,7 +566,7 @@ }, { "cell_type": "markdown", - "id": "43", + "id": "42", "metadata": {}, "source": [ "## 8. Submit the job and monitor the status" @@ -595,7 +575,7 @@ { "cell_type": "code", "execution_count": null, - "id": "44", + "id": "43", "metadata": {}, "outputs": [], "source": [ @@ -605,7 +585,7 @@ { "cell_type": "code", "execution_count": null, - "id": "45", + "id": "44", "metadata": {}, "outputs": [], "source": [ @@ -616,7 +596,7 @@ }, { "cell_type": "markdown", - "id": "46", + "id": "45", "metadata": {}, "source": [ "## 9. Retrieve results" @@ -625,7 +605,7 @@ { "cell_type": "code", "execution_count": null, - "id": "47", + "id": "46", "metadata": {}, "outputs": [], "source": [ @@ -639,7 +619,7 @@ { "cell_type": "code", "execution_count": null, - "id": "48", + "id": "47", "metadata": {}, "outputs": [], "source": []