Skip to content

Commit

Permalink
update _default folder
Browse files Browse the repository at this point in the history
  • Loading branch information
idocx committed Jul 9, 2024
1 parent 066468f commit 727f803
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion alab_management/_default/devices/default_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def is_running(self):
"""
Check if the device is running.
Returns:
Returns
-------
bool: True if the device is running, False otherwise.
"""
Expand Down
22 changes: 21 additions & 1 deletion alab_management/_default/tasks/default_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ def __init__(self, sample: ObjectId, *args, **kwargs):
self.sample = sample

def run(self):
"""
The main logic of the task.
You can request resources, move samples, and communicate with devices in this method.
Finally, the return value of this method will be stored as the result of the task (valiated
by `result_specification`).
"""
with self.lab_view.request_resources({None: {"DefaultSamplePosition": 1}}) as (
_,
sample_positions,
Expand All @@ -31,4 +38,17 @@ def validate(self) -> bool:

@property
def result_specification(self) -> type[BaseModel]:
pass
"""
The result specification of the task.
The method should return a pydantic model that defines the result of the task. The result
will be validated using the result_specification.
"""

class DefaultTaskResult(BaseModel):
"""The result of the default task."""

mass: float
temperature: float

return DefaultTaskResult

0 comments on commit 727f803

Please sign in to comment.