-
Notifications
You must be signed in to change notification settings - Fork 31
Adding a new ready condition FileState
#402
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -208,6 +208,17 @@ component_properties (object) | |
| * **Allowed Values:** | ||
| * ``"Running"``: The process has started and reached its running state. | ||
| * ``"Terminated"``: The process has started, reached its running state, and then terminated successfully. | ||
| * **file_state** (object, optional) | ||
| * **Description:** Specifies a ready condition based on the existence state of a file at a given path. | ||
| * **Properties:** | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume we do not need a dedicated timeout here and we will use the existing ready_timeout parameter. |
||
| * **file_path** (string, required) | ||
| * **Description:** Specifies the absolute path to the file being watched. | ||
| * **state** (string, optional) | ||
| * **Description:** Specifies the required existence state of the file. | ||
| * **Allowed Values:** | ||
| * ``"Exists"``: The component is ready when the file at ``file_path`` exists. | ||
| * ``"Deleted"``: The component is ready when the file at ``file_path`` is deleted. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are there any files which cannot be watched via inotify and thus we need to poll for their existence with some to-be-configured interval? |
||
| * **Default:** ``"Exists"`` | ||
|
|
||
| .. _lm_conf_deployment_config_object_: | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,6 +37,12 @@ enum class ProcessState : uint8_t | |
| Terminated = 1 | ||
| }; | ||
|
|
||
| enum class FileExistenceState : uint8_t | ||
| { | ||
| Exists = 0, | ||
| Deleted, | ||
| }; | ||
|
|
||
| struct ComponentAliveSupervision | ||
| { | ||
| uint32_t reporting_cycle_ms{}; | ||
|
|
@@ -52,9 +58,16 @@ struct ApplicationProfile | |
| std::optional<ComponentAliveSupervision> alive_supervision; | ||
| }; | ||
|
|
||
| struct FileState | ||
| { | ||
| std::string file_path; | ||
| FileExistenceState state{FileExistenceState::Exists}; | ||
| }; | ||
|
|
||
| struct ReadyCondition | ||
| { | ||
| ProcessState process_state{ProcessState::Running}; | ||
| std::optional<ProcessState> process_state{ProcessState::Running}; | ||
| std::optional<FileState> file_state; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if here or even in the user config we shall introduce some 'type' attribute that defines which type of ready condition is configured/used, or is it intended to support any combinations of these? "readyCondition" : {
"type": "PROCESS_STATE",
....
}For now with just 2 types its probably still manageable as is. |
||
| }; | ||
|
|
||
| struct ComponentProperties | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -89,6 +89,28 @@ | |
| "Terminated" | ||
| ], | ||
| "description": "Specifies the required state of the component's POSIX process. 'Running': the process has started and reached its running state. 'Terminated': the process has started, reached its running state, and then terminated successfully." | ||
| }, | ||
| "file_state": { | ||
| "type": "object", | ||
| "description": "Specifies a ready condition based on the existence state of a file at a given path.", | ||
| "properties": { | ||
| "file_path": { | ||
| "type": "string", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to specify a regex here to validate the basic format of the path? |
||
| "description": "Specifies the absolute path to the file being watched." | ||
| }, | ||
| "state": { | ||
| "type": "string", | ||
| "enum": [ | ||
| "Exists", | ||
| "Deleted" | ||
| ], | ||
| "description": "Specifies the required existence state of the file. 'Exists': the file must be present at 'file_path'. 'Deleted': the file must be absent from 'file_path'. Defaults to 'Exists' if not specified." | ||
| } | ||
| }, | ||
| "required": [ | ||
| "file_path" | ||
| ], | ||
| "additionalProperties": false | ||
| } | ||
| }, | ||
| "required": [], | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,12 @@ enum ProcessState : byte { | |
| Terminated = 1 | ||
| } | ||
|
|
||
| // Specifies the required existence state of a watched file. | ||
| enum FileExistenceState : byte { | ||
| Exists = 0, | ||
| Deleted = 1 | ||
| } | ||
|
|
||
| // Scheduling policy for a component's initial thread. | ||
| enum SchedulingPolicy : byte { | ||
| OTHER = 0, | ||
|
|
@@ -53,9 +59,18 @@ table ApplicationProfile { | |
| alive_supervision:ComponentAliveSupervision; // optional | ||
| } | ||
|
|
||
| // Defines a ready condition based on the existence state of a file at a given path. | ||
| table FileState { | ||
| // Absolute path to the file being watched. | ||
| file_path:string (required); // required | ||
| // Existence state of the file. Defaults to Exists if not specified. | ||
| state:FileExistenceState = Exists; // optional, defaults to Exists | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently, all the default values are in scripts/config_mapping/lifecycle_config.py I think this mapping is not existing in the PR |
||
| } | ||
|
|
||
| // Defines the conditions that determine when the component enters the ready state. | ||
| table ReadyCondition { | ||
| process_state:ProcessState = null; // required | ||
| file_state:FileState; // optional | ||
| } | ||
|
|
||
| // Defines essential characteristics of a software component. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it valid to configure both process_state and file_state at the same time?