Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 403 on delete project when running all cells in one go. #519

Merged
merged 3 commits into from
Nov 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 52 additions & 51 deletions notebooks/001_create_project.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "3cb49dd2-7032-40e0-a4c2-8203ba1072bf",
"metadata": {},
"outputs": [],
"source": [
"from geti_sdk.utils import get_server_details_from_env\n",
"\n",
"geti_server_configuration = get_server_details_from_env()"
]
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
Expand All @@ -34,15 +34,15 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "ba8318f4-3d97-4949-abf0-6cdafe46572e",
"metadata": {},
"outputs": [],
"source": [
"from geti_sdk import Geti\n",
"\n",
"geti = Geti(server_config=geti_server_configuration)"
]
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
Expand All @@ -55,17 +55,17 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "081e700d-9e2e-4022-b4d6-dac3adf1d4f8",
"metadata": {},
"outputs": [],
"source": [
"from geti_sdk.rest_clients import ProjectClient\n",
"\n",
"project_client = ProjectClient(session=geti.session, workspace_id=geti.workspace_id)\n",
"\n",
"projects = project_client.list_projects()"
]
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
Expand All @@ -89,10 +89,8 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "30e46136-5283-4e3d-8dcf-7a89bee4de6b",
"metadata": {},
"outputs": [],
"source": [
"from geti_sdk.data_models.enums import TaskType\n",
"\n",
Expand All @@ -101,7 +99,9 @@
"for task_type in TaskType:\n",
" if task_type.is_trainable:\n",
" print(\" \" + str(task_type))"
]
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -138,29 +138,29 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "b18c25d1-f53b-495e-a48e-ee89b7f95d4e",
"metadata": {},
"outputs": [],
"source": [
"# First set the project parameters. Feel free to experiment here!\n",
"PROJECT_NAME = \"Segmentation demo\"\n",
"PROJECT_TYPE = \"segmentation\"\n",
"LABELS = [[\"dog\", \"cat\", \"horse\"]]"
]
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
"execution_count": null,
"id": "4941f712-f97b-48ff-a11b-74687d0bb49f",
"metadata": {},
"outputs": [],
"source": [
"# Now, use the project client to create the project\n",
"project = project_client.create_project(\n",
" project_name=PROJECT_NAME, project_type=PROJECT_TYPE, labels=LABELS\n",
")"
]
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
Expand All @@ -173,13 +173,13 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "c9d3496b-663d-41d3-b381-5e05b4c8e5b0",
"metadata": {},
"outputs": [],
"source": [
"print(project.summary)"
]
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
Expand All @@ -191,13 +191,13 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "8786e8df-3ecb-4947-ad71-c8512e0b22ac",
"metadata": {},
"outputs": [],
"source": [
"print(project.overview)"
]
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
Expand All @@ -209,16 +209,16 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "01cb2ee6-9d45-4d17-aa6f-2ac0330ce369",
"metadata": {},
"outputs": [],
"source": [
"task_list = project.get_trainable_tasks()\n",
"print(f\"Project '{project.name}' contains {len(task_list)} trainable tasks.\")\n",
"for task in task_list:\n",
" print(task.summary)"
]
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
Expand All @@ -230,14 +230,14 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "71dbcca8-b79e-441d-9143-091c2b08ba35",
"metadata": {},
"outputs": [],
"source": [
"project = project_client.get_project(project_name=PROJECT_NAME)\n",
"print(project.summary)"
]
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
Expand All @@ -250,10 +250,8 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "9c20a99c-07b6-4cc2-87fa-abf0ba210031",
"metadata": {},
"outputs": [],
"source": [
"PIPELINE_PROJECT_NAME = \"Detection to hierarchical classification demo\"\n",
"PIPELINE_PROJECT_TYPE = \"detection_to_classification\"\n",
Expand All @@ -270,21 +268,23 @@
" {\"name\": \"school bus\", \"parent_id\": \"bus\", \"group\": \"bus\"},\n",
" ],\n",
"]"
]
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
"execution_count": null,
"id": "01d01757-035c-4690-86f0-2f40487a6c52",
"metadata": {},
"outputs": [],
"source": [
"pipeline_project = project_client.create_project(\n",
" project_name=PIPELINE_PROJECT_NAME,\n",
" project_type=PIPELINE_PROJECT_TYPE,\n",
" labels=PIPELINE_LABELS,\n",
")"
]
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
Expand All @@ -296,13 +296,13 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "71a5b21f-edf6-4be4-8e86-08db768040f2",
"metadata": {},
"outputs": [],
"source": [
"print(pipeline_project.summary)"
]
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
Expand All @@ -314,13 +314,13 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "d23f29b8-056d-476a-a244-5f7355e00743",
"metadata": {},
"outputs": [],
"source": [
"print(pipeline_project.overview)"
]
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
Expand All @@ -339,15 +339,15 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "e2a2548a-8f84-4395-bdf7-8a4ebf3447a3",
"metadata": {},
"outputs": [],
"source": [
"# Delete the simple project\n",
"\n",
"# project_client.delete_project(project)"
]
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
Expand All @@ -361,22 +361,23 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "ab209bce-5195-4f40-9d40-032af0bb5031",
"metadata": {},
"outputs": [],
"source": [
"# Delete the pipeline project\n",
"project_client.delete_project(pipeline_project, requires_confirmation=False)"
]
"\n",
"# project_client.delete_project(pipeline_project, requires_confirmation=False)"
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
"execution_count": null,
"id": "fa885dd0-b669-4c83-b6b2-bbde010144cd",
"metadata": {},
"source": [],
"outputs": [],
"source": []
"execution_count": null
}
],
"metadata": {
Expand Down
Loading