Skip to content

Commit

Permalink
status_formula added to application_rules XML-RPC
Browse files Browse the repository at this point in the history
  • Loading branch information
julien6387 committed Apr 3, 2024
1 parent ae0d2d0 commit 0f7dd99
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
11 changes: 6 additions & 5 deletions docs/xml_rpc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -173,25 +173,26 @@ Status
'application_name' ``str`` The Application name.
'managed' ``bool`` The Application managed status in |Supvisors|. When ``False``,
the following attributes are not provided.
'distribution' ``str`` The distribution rule of the application,
'distribution' ``str`` The distribution rule of the Application,
in [``'ALL_INSTANCES'``, ``'SINGLE_INSTANCE'``,
``'SINGLE_NODE'``].
'identifiers' ``list(str)`` The deduced names of all |Supvisors| instances where the
non-fully distributed application processes can be started,
non-fully distributed Application processes can be started,
provided only if ``distribution`` is not ``ALL_INSTANCES``.
'start_sequence' ``int`` The Application starting rank when starting all applications,
in [0;127].
'stop_sequence' ``int`` The Application stopping rank when stopping all applications,
in [0;127].
'starting_strategy' ``str`` The strategy applied when starting application automatically,
'starting_strategy' ``str`` The strategy applied when starting Application automatically,
in [``'CONFIG'``, ``'LESS_LOADED'``, ``'MOST_LOADED'``,
``'LOCAL'``, ``'LESS_LOADED_NODE'``, ``'MOST_LOADED_NODE'``].
'starting_failure_strategy' ``str`` The strategy applied when a process crashes in a starting
application, in [``'ABORT'``, ``'STOP'``, ``'CONTINUE'``].
Application, in [``'ABORT'``, ``'STOP'``, ``'CONTINUE'``].
'running_failure_strategy' ``str`` The strategy applied when a process crashes in a running
application, in [``'CONTINUE'``, ``'RESTART_PROCESS'``,
Application, in [``'CONTINUE'``, ``'RESTART_PROCESS'``,
``'STOP_APPLICATION'``, ``'RESTART_APPLICATION'``,
``'SHUTDOWN'``, ``'RESTART'``].
'status_formula' ``str`` The ``operational_status`` formula set in the Application rule.
=========================== =============== ===========

.. automethod:: get_process_rules(namespec)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ public class SupvisorsApplicationRules implements SupvisorsAnyInfo {
/** The strategy applied when a process crashes at application running time. */
private RunningFailureStrategy runningFailureStrategy;

/** The formula applied to define the application operational status. */
private String statusFormula;

/**
* The constructor gets all information from an HashMap.
*
Expand All @@ -74,6 +77,7 @@ public SupvisorsApplicationRules(HashMap rulesInfo) {
this.startingStrategy = StartingStrategy.valueOf((String) rulesInfo.get("starting_strategy"));
this.startingFailureStrategy = StartingFailureStrategy.valueOf((String) rulesInfo.get("starting_failure_strategy"));
this.runningFailureStrategy = RunningFailureStrategy.valueOf((String) rulesInfo.get("running_failure_strategy"));
this.statusFormula = (String) rulesInfo.get("status_formula");
}
}

Expand Down Expand Up @@ -171,6 +175,15 @@ public RunningFailureStrategy getRunningFailureStrategy() {
return this.runningFailureStrategy;
}

/**
* The getStatusFormula method returns the formula applied to define the application operational status.
*
* @return String: The formula for the application operational status.
*/
public String getStatusFormula() {
return this.statusFormula;
}

/**
* The toString method returns a printable form of the contents of the instance.
*
Expand All @@ -185,7 +198,8 @@ public String toString() {
+ " startSequence=" + this.startSequence + " stopSequence=" + this.stopSequence
+ " startingStrategy=" + this.startingStrategy
+ " startingFailureStrategy=" + this.startingFailureStrategy
+ " runningFailureStrategy=" + this.runningFailureStrategy;
+ " runningFailureStrategy=" + this.runningFailureStrategy
+ " statusFormula=\"" + this.statusFormula + "\"";
}
rulesString += ")";
return rulesString;
Expand Down

0 comments on commit 0f7dd99

Please sign in to comment.