Skip to content

Commit 24326d7

Browse files
authored
Merge pull request #363 from simvue-io/hotfix/docstring-tidy
Added missing docstrings
2 parents 6f429e5 + d234769 commit 24326d7

File tree

1 file changed

+102
-17
lines changed

1 file changed

+102
-17
lines changed

simvue/run.py

Lines changed: 102 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ def reconnect(self, run_id: str) -> bool:
755755
Returns
756756
-------
757757
bool
758-
_description_
758+
whether reconnection succeeded
759759
"""
760760
if self._mode == "disabled":
761761
return True
@@ -842,10 +842,18 @@ def config(
842842
@check_run_initialised
843843
@pydantic.validate_call
844844
def update_metadata(self, metadata: dict[str, typing.Any]) -> bool:
845-
"""
846-
Add/update metadata
847-
"""
845+
"""Update metadata for this run
848846
847+
Parameters
848+
----------
849+
metadata : dict[str, typing.Any]
850+
set run metadata
851+
852+
Returns
853+
-------
854+
bool
855+
if the update was successful
856+
"""
849857
if self._mode == "disabled":
850858
return True
851859

@@ -868,8 +876,17 @@ def update_metadata(self, metadata: dict[str, typing.Any]) -> bool:
868876
@check_run_initialised
869877
@pydantic.validate_call
870878
def update_tags(self, tags: list[str]) -> bool:
871-
"""
872-
Add/update tags
879+
"""Update tags for this run
880+
881+
Parameters
882+
----------
883+
tags : list[str]
884+
new set of tags to assign
885+
886+
Returns
887+
-------
888+
bool
889+
whether the update was successful
873890
"""
874891
if self._mode == "disabled":
875892
return True
@@ -888,9 +905,20 @@ def update_tags(self, tags: list[str]) -> bool:
888905
@skip_if_failed("_aborted", "_suppress_errors", False)
889906
@check_run_initialised
890907
@pydantic.validate_call
891-
def log_event(self, message, timestamp: typing.Optional[str] = None) -> bool:
892-
"""
893-
Write event
908+
def log_event(self, message: str, timestamp: typing.Optional[str] = None) -> bool:
909+
"""Log event to the server
910+
911+
Parameters
912+
----------
913+
message : str
914+
event message to log
915+
timestamp : str, optional
916+
manually specify the time stamp for this log, by default None
917+
918+
Returns
919+
-------
920+
bool
921+
whether event log was successful
894922
"""
895923
if self._mode == "disabled":
896924
self._error("Cannot log events in 'disabled' state")
@@ -970,8 +998,23 @@ def log_metrics(
970998
time: typing.Optional[int] = None,
971999
timestamp: typing.Optional[str] = None,
9721000
) -> bool:
973-
"""
974-
Write metrics
1001+
"""Log metrics to Simvue server
1002+
1003+
Parameters
1004+
----------
1005+
metrics : dict[str, typing.Union[int, float]]
1006+
set of metrics to upload to server for this run
1007+
step : int, optional
1008+
manually specify the step index for this log, by default None
1009+
time : int, optional
1010+
manually specify the time for this log, by default None
1011+
timestamp : str, optional
1012+
manually specify the timestamp for this log, by default None
1013+
1014+
Returns
1015+
-------
1016+
bool
1017+
if the metric log was succcessful
9751018
"""
9761019
add_dispatch = self._add_metrics_to_dispatch(
9771020
metrics, step=step, time=time, timestamp=timestamp
@@ -1129,8 +1172,23 @@ def save_directory(
11291172
filetype: typing.Optional[str] = None,
11301173
preserve_path: bool = False,
11311174
) -> bool:
1132-
"""
1133-
Upload a whole directory
1175+
"""Upload files from a whole directory
1176+
1177+
Parameters
1178+
----------
1179+
directory : pydantic.DirectoryPath
1180+
the directory to save to the run
1181+
category : Literal[['output', 'input', 'code']
1182+
the category to assign to the saved objects within this directory
1183+
filetype : str, optional
1184+
manually specify the MIME type for items in the directory, by default None
1185+
preserve_path : bool, optional
1186+
preserve the full path, by default False
1187+
1188+
Returns
1189+
-------
1190+
bool
1191+
if the directory save was successful
11341192
"""
11351193
if self._mode == "disabled":
11361194
return True
@@ -1166,8 +1224,23 @@ def save_all(
11661224
filetype: typing.Optional[str] = None,
11671225
preserve_path: bool = False,
11681226
) -> bool:
1169-
"""
1170-
Save the list of files and/or directories
1227+
"""Save a set of files and directories
1228+
1229+
Parameters
1230+
----------
1231+
items : list[pydantic.FilePath | pydantic.DirectoryPath]
1232+
list of file paths and directories to save
1233+
category : Literal['input', 'output', 'code']
1234+
the category to assign to the saved objects
1235+
filetype : str, optional
1236+
manually specify the MIME type for all items, by default None
1237+
preserve_path : bool, optional
1238+
_preserve the full path, by default False
1239+
1240+
Returns
1241+
-------
1242+
bool
1243+
whether the save was successful
11711244
"""
11721245
success: bool = True
11731246

@@ -1194,7 +1267,13 @@ def set_status(
11941267
self, status: typing.Literal["completed", "failed", "terminated"]
11951268
) -> bool:
11961269
"""Set run status
1197-
status to assign to this run
1270+
1271+
status to assign to this run
1272+
1273+
Parameters
1274+
----------
1275+
status : Literal['completed', 'failed', 'terminated']
1276+
status to set the run to
11981277
11991278
Returns
12001279
-------
@@ -1221,7 +1300,13 @@ def set_status(
12211300

12221301
@skip_if_failed("_aborted", "_suppress_errors", False)
12231302
def close(self) -> bool:
1224-
"""Close the run"""
1303+
"""Close the run
1304+
1305+
Returns
1306+
-------
1307+
bool
1308+
whether close was successful
1309+
"""
12251310
self._executor.wait_for_completion()
12261311
if self._mode == "disabled":
12271312
return True

0 commit comments

Comments
 (0)