hertzforge.io.data_folder¶
data_folder
¶
The data folder control runs are kept in, and deleting a run from it.
The control service writes each run's folder under its data folder
(docs/run-folder.md): the folder HERTZFORGE_DATA_ROOT names, else
Hertzforge_Data in the home folder. data_root resolves it by the same
rule, so the analysis service, started beside the control service with the
same environment, names the same folder.
delete_run is the one place a run is deleted. It removes a run folder,
and with it the project file the folder was converted to (<run name>.hforge
inside it, run_convert.default_output), and only ever a folder that is a
run folder inside the data folder, reached without a link, whose run has
ended and whose project file is not open. plan_delete makes every check
and deletes nothing, so a confirmation can name what would go.
Classes:
| Name | Description |
|---|---|
RunDeleteRefused |
A run that is not deleted, and why: |
RunDelete |
What deleting a run removes: the run folder, and the project file |
Functions:
| Name | Description |
|---|---|
data_root |
The data folder, as the control service resolves it: the folder |
data_root_source |
Where the data folder comes from: |
plan_delete |
What deleting the run in |
delete_run |
Delete the run in |
Classes¶
RunDeleteRefused
¶
Bases: Exception
A run that is not deleted, and why: code names the refusal, the
message says it in words a person can act on. Nothing was deleted.
RunDelete
dataclass
¶
What deleting a run removes: the run folder, and the project file it was converted to, which lies inside it.
Functions:¶
data_root
¶
The data folder, as the control service resolves it: the folder
HERTZFORGE_DATA_ROOT names, used as it is (an empty value is unset),
else Hertzforge_Data in the home folder, else in the working folder
when there is no home folder.
Returns:
| Type | Description |
|---|---|
str
|
The folder's absolute path. It need not exist yet. |
data_root_source
¶
Where the data folder comes from: environment when
HERTZFORGE_DATA_ROOT names it, default otherwise.
plan_delete
¶
plan_delete(folder: str | PathLike, root: str | PathLike | None = None, open_files: Iterable[str | PathLike] = (), not_live: bool = False) -> RunDelete
What deleting the run in folder would remove, after every check
delete_run makes; nothing is deleted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folder
|
str or PathLike
|
The run folder, or its |
required |
root
|
str or PathLike
|
The data folder; |
None
|
open_files
|
iterable of path-like
|
Files open now (the open project's file, the files its arrays are mapped from): a run holding one is not deleted. |
()
|
not_live
|
bool
|
True when the caller has established, from the control service, that
no live run is recording into |
False
|
Returns:
| Type | Description |
|---|---|
RunDelete
|
The folder and its project file. |
Raises:
| Type | Description |
|---|---|
RunDeleteRefused
|
|
delete_run
¶
delete_run(folder: str | PathLike, root: str | PathLike | None = None, open_files: Iterable[str | PathLike] = (), not_live: bool = False) -> RunDelete
Delete the run in folder: its folder, and the project file it was
converted to inside it, after the checks of plan_delete.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folder
|
str | PathLike
|
As |
required |
root
|
str | PathLike
|
As |
required |
open_files
|
str | PathLike
|
As |
required |
not_live
|
str | PathLike
|
As |
required |
Returns:
| Type | Description |
|---|---|
RunDelete
|
What was deleted. |
Raises:
| Type | Description |
|---|---|
RunDeleteRefused
|
As |
OSError
|
When the operating system refuses part of the delete; what it could not delete is left. |