Skip to content

Commit fbe5857

Browse files
authored
Web API 2 (#50)
Web API 2
1 parent 208589c commit fbe5857

File tree

10 files changed

+251
-0
lines changed

10 files changed

+251
-0
lines changed

_faqs/web.delete.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
title: Web.delete?
3+
date: 2025-09-29 11:29:13
4+
enabled: true
5+
category: "Web API"
6+
---
7+
The [`web.delete`](https://docs.flexcompute.com/projects/tidy3d/en/latest/api/_autosummary/tidy3d.web.api.webapi.delete.html){: .color-primary-hover} function in Tidy3D is used to remove simulation stored on the server. This is useful for managing storage and ensuring that old or unnecessary tasks don’t take up space.
8+
9+
## What does it do?
10+
Given a *task_id*, the function deletes the corresponding simulation. You can choose to delete only the specific version of the task or all versions within the same task group.
11+
12+
## Example
13+
<div markdown class="code-snippet">
14+
{% highlight python %}
15+
from tidy3d import web
16+
17+
# Delete only this version
18+
web.delete(task_id)
19+
20+
# Delete all versions of the task group
21+
web.delete(task_id, versions=True)
22+
{% endhighlight %}
23+
{% include copy-button.html %}</div>
24+
25+
## Parameters
26+
- **task_id** *(str)*: Unique identifier of the task on the server (returned by `web.upload`).
27+
- **versions** *(bool, default=False)*:
28+
- `False`: Deletes only the task version associated with the given *task_id*.
29+
- `True`: Deletes all versions of the task in the task group.
30+
31+
## Returns
32+
- **TaskInfo**: An object containing information about the task status, size, and credit usage.

_faqs/web.delete_old.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: Web.delete_old?
3+
date: 2025-09-29 11:29:13
4+
enabled: true
5+
category: "Web API"
6+
---
7+
The [`web.delete_old`](https://docs.flexcompute.com/projects/tidy3d/en/latest/api/_autosummary/tidy3d.web.api.webapi.delete_old.html){: .color-primary-hover} function is used to automatically clean up older simulation tasks stored on the server. It helps manage storage by removing tasks that are no longer needed after a certain number of days.
8+
9+
## What does it do?
10+
Given a time threshold in days, the function deletes all tasks older than that age in a specified folder. This makes it easy to clear out outdated simulations without manually deleting them one by one.
11+
Be aware that deleted tasks *can't be recovered*.
12+
13+
- **int**: The total number of tasks deleted.
14+
15+
## Example
16+
17+
<div markdown class="code-snippet">
18+
{% highlight python %}
19+
from tidy3d import web
20+
21+
# Delete all tasks older than 60 days in the default folder
22+
num_deleted = web.delete_old(days_old=60)
23+
24+
print(f"Deleted {num_deleted} old tasks.")
25+
{% endhighlight %}
26+
{% include copy-button.html %}</div>
27+
28+
## Parameters
29+
- **days_old** *(int, default=100)*: Minimum number of days since task creation. Tasks older than this will be deleted.
30+
- **folder** *(str, default="default")*: Folder where the deletion will occur. Only one folder can be specified at a time.

_faqs/web.get_info.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
title: Web.get_info?
3+
date: 2025-09-29 11:29:13
4+
enabled: true
5+
category: "Web API"
6+
---
7+
The [`web.get_info`](https://docs.flexcompute.com/projects/tidy3d/en/latest/api/_autosummary/tidy3d.web.api.webapi.get_info.html){: .color-primary-hover} function retrieves detailed information about a simulation.
8+
9+
Given a *task_id* (returned when you upload a simulation), `get_info` returns a [`TaskInfo`](https://docs.flexcompute.com/projects/tidy3d/en/v2.5.1/_autosummary/tidy3d.web.core.task_info.TaskInfo.html){: .color-primary-hover} object. This object includes details such as whether the task is running or completed and how many FlexCredits were consumed. It’s useful for monitoring progress or checking costs after a run.
10+
11+
## Parameters
12+
- **task_id** *(str)*: Unique identifier of the task on the server (returned by `web.upload`).
13+
- **verbose** *(bool, default=True)*: If `True`, prints progress bars and status updates. If `False`, runs silently.
14+
15+
## Returns
16+
- **TaskInfo**: An object containing status, size, and credit information for the task.
17+
18+
## Example
19+
<div markdown class="code-snippet">
20+
{% highlight python %}
21+
from tidy3d import web
22+
23+
# Get task information
24+
info = web.get_info(task_id)
25+
26+
print(info.status) # e.g., "success"
27+
print(info.realCost) # e.g., 0.025
28+
{% endhighlight %}
29+
{% include copy-button.html %}</div>

_faqs/web.run_async.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: Web.run_async?
3+
date: 2025-09-29 11:29:13
4+
enabled: true
5+
category: "Web API"
6+
---
7+
The [`web.run_async`](https://docs.flexcompute.com/projects/tidy3d/en/latest/api/_autosummary/tidy3d.plugins.adjoint.web.run_async.html){: .color-primary-hover} function in Tidy3D allows you to submit and run multiple simulations in parallel on the server. It supports different simulation types (FDTD, Mode, HeatCharge, EME and RF) and automatically monitors, downloads, and loads the results into a [`web.BatchData`](https://docs.flexcompute.com/projects/tidy3d/en/latest/api/_autosummary/tidy3d.web.api.container.BatchData.html){: .color-primary-hover} object.
8+
9+
<div markdown class="code-snippet">
10+
{% highlight python %}
11+
batch_results = web.run_async(simulations=sims, verbose=verbose)
12+
{% endhighlight %}
13+
{% include copy-button.html %}</div>
14+
15+
## For virtual GPU users
16+
17+
To run simulations in parallel, it is necessary to use your FlexCredit pool. To do this, set `pay_type = "FLEX_CREDITS"`:
18+
19+
<div markdown class="code-snippet">
20+
{% highlight python %}
21+
batch_results = web.run_async(simulations=sims, verbose=verbose,pay_type="FLEX_CREDITS")
22+
{% endhighlight %}
23+
{% include copy-button.html %}</div>

docs/faq/web.delete.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Web.delete?
2+
3+
| Date | Category |
4+
|------------|-------------|
5+
| 2025-09-29 11:29:13 | Web API |
6+
7+
8+
The [`web.delete`](https://docs.flexcompute.com/projects/tidy3d/en/latest/api/_autosummary/tidy3d.web.api.webapi.delete.html) function in Tidy3D is used to remove simulation stored on the server. This is useful for managing storage and ensuring that old or unnecessary tasks don’t take up space.
9+
10+
## What does it do?
11+
Given a *task_id*, the function deletes the corresponding simulation. You can choose to delete only the specific version of the task or all versions within the same task group.
12+
13+
## Example
14+
15+
16+
```python
17+
from tidy3d import web
18+
19+
# Delete only this version
20+
web.delete(task_id)
21+
22+
# Delete all versions of the task group
23+
web.delete(task_id, versions=True)
24+
```
25+
26+
27+
28+
## Parameters
29+
- **task_id** *(str)*: Unique identifier of the task on the server (returned by `web.upload`).
30+
- **versions** *(bool, default=False)*:
31+
- `False`: Deletes only the task version associated with the given *task_id*.
32+
- `True`: Deletes all versions of the task in the task group.
33+
34+
## Returns
35+
- **TaskInfo**: An object containing information about the task status, size, and credit usage.

docs/faq/web.delete_old.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Web.delete_old?
2+
3+
| Date | Category |
4+
|------------|-------------|
5+
| 2025-09-29 11:29:13 | Web API |
6+
7+
8+
The [`web.delete_old`](https://docs.flexcompute.com/projects/tidy3d/en/latest/api/_autosummary/tidy3d.web.api.webapi.delete_old.html) function is used to automatically clean up older simulation tasks stored on the server. It helps manage storage by removing tasks that are no longer needed after a certain number of days.
9+
10+
## What does it do?
11+
Given a time threshold in days, the function deletes all tasks older than that age in a specified folder. This makes it easy to clear out outdated simulations without manually deleting them one by one.
12+
Be aware that deleted tasks *can't be recovered*.
13+
14+
- **int**: The total number of tasks deleted.
15+
16+
## Example
17+
18+
19+
20+
```python
21+
from tidy3d import web
22+
23+
# Delete all tasks older than 60 days in the default folder
24+
num_deleted = web.delete_old(days_old=60)
25+
26+
print(f"Deleted {num_deleted} old tasks.")
27+
```
28+
29+
30+
31+
## Parameters
32+
- **days_old** *(int, default=100)*: Minimum number of days since task creation. Tasks older than this will be deleted.
33+
- **folder** *(str, default="default")*: Folder where the deletion will occur. Only one folder can be specified at a time.

docs/faq/web.get_info.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Web.get_info?
2+
3+
| Date | Category |
4+
|------------|-------------|
5+
| 2025-09-29 11:29:13 | Web API |
6+
7+
8+
The [`web.get_info`](https://docs.flexcompute.com/projects/tidy3d/en/latest/api/_autosummary/tidy3d.web.api.webapi.get_info.html) function retrieves detailed information about a simulation.
9+
10+
Given a *task_id* (returned when you upload a simulation), `get_info` returns a [`TaskInfo`](https://docs.flexcompute.com/projects/tidy3d/en/v2.5.1/_autosummary/tidy3d.web.core.task_info.TaskInfo.html) object. This object includes details such as whether the task is running or completed and how many FlexCredits were consumed. It’s useful for monitoring progress or checking costs after a run.
11+
12+
## Parameters
13+
- **task_id** *(str)*: Unique identifier of the task on the server (returned by `web.upload`).
14+
- **verbose** *(bool, default=True)*: If `True`, prints progress bars and status updates. If `False`, runs silently.
15+
16+
## Returns
17+
- **TaskInfo**: An object containing status, size, and credit information for the task.
18+
19+
## Example
20+
21+
22+
```python
23+
from tidy3d import web
24+
25+
# Get task information
26+
info = web.get_info(task_id)
27+
28+
print(info.status) # e.g., "success"
29+
print(info.realCost) # e.g., 0.025
30+
```
31+
32+

docs/faq/web.run_async.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Web.run_async?
2+
3+
| Date | Category |
4+
|------------|-------------|
5+
| 2025-09-29 11:29:13 | Web API |
6+
7+
8+
The [`web.run_async`](https://docs.flexcompute.com/projects/tidy3d/en/latest/api/_autosummary/tidy3d.plugins.adjoint.web.run_async.html) function in Tidy3D allows you to submit and run multiple simulations in parallel on the server. It supports different simulation types (FDTD, Mode, HeatCharge, EME and RF) and automatically monitors, downloads, and loads the results into a [`web.BatchData`](https://docs.flexcompute.com/projects/tidy3d/en/latest/api/_autosummary/tidy3d.web.api.container.BatchData.html) object.
9+
10+
11+
12+
```python
13+
batch_results = web.run_async(simulations=sims, verbose=verbose)
14+
```
15+
16+
17+
18+
## For virtual GPU users
19+
20+
To run simulations in parallel, it is necessary to use your FlexCredit pool. To do this, set `pay_type = "FLEX_CREDITS"`:
21+
22+
23+
24+
```python
25+
batch_results = web.run_async(simulations=sims, verbose=verbose,pay_type="FLEX_CREDITS")
26+
```
27+
28+

docs/web-api.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@ Web API
1313
faq/web.estimate_cost.md
1414
faq/td.SimulationData.from_file.md
1515
faq/web.load.md
16+
faq/web.get_info.md
17+
faq/web.run_async.md
18+
faq/web.delete.md
19+
faq/web.delete_old.md

faq_categories.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,11 @@
351351
"_faqs/web.account.md",
352352
"_faqs/web.estimate_cost.md",
353353
"_faqs/td.SimulationData.from_file.md",
354+
"_faqs/web.load.md",
355+
"_faqs/web.get_info.md",
356+
"_faqs/web.run_async.md",
357+
"_faqs/web.delete.md",
358+
"_faqs/web.delete_old.md"
354359
"_faqs/web.load.md"
355360
]
356361
}

0 commit comments

Comments
 (0)