Skip to content
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

Start/Restart action should start depended on disabled services #44

Open
thenonameguy opened this issue Feb 9, 2023 · 7 comments
Open

Comments

@thenonameguy
Copy link
Sponsor Contributor

thenonameguy commented Feb 9, 2023

If you have a service config like:

    depends_on:
      kafka:
        condition: process_healthy
      sftp:
        condition: process_started

for a seldomly used subset of your system (therefore using disabled: true for both the service and it's dependencies (kafka and sftp)) currently starting/restarting the service does not visually do anything.

Expectation: start sftp/ kafka so the depends_on conditions have a chance to be met.

@thenonameguy thenonameguy changed the title Start/Restart action should start depended disabled services Start/Restart action should start depended on disabled services Feb 9, 2023
@F1bonacc1
Copy link
Owner

Hi @thenonameguy,

Makes sense. Will look into it.

@F1bonacc1
Copy link
Owner

Hi @thenonameguy,

I tried to reconstruct your scenario and here is what I found:

  1. Consider that the processes are always DAG.
  2. For example A->B->C.
  3. If not disabled A will wait on B, while B is in a running or waiting for C state.
  4. If both (A+B) are disabled, A (if started manually) won't wait for B since it's neither in waiting nor in running state.

TL;DR A will run even if it depends on B to be healthy, but B is disabled.

Now I am trying to understand how your configuration is different from mine, that it caused it to wait for B (kafka or sftp) to run, even if B is disabled.

On another topic:
When started manually, is starting the entire chain, always the desired behavior? Or only when disabled?
I am a little bit worried that it can cause some unintended consequences - someone starting A, but accidentally B will cause some damage.
I probably can add the with dependencies parameter to REST, but in UI it might be annoying to ask it each time.

Will be happy to hear your thoughts.

@camcalaquian
Copy link

It would be nice if we can add a flag in the process configuration to allow dependent processes to start automatically or at least wait for the dependent process to start.

@F1bonacc1
Copy link
Owner

F1bonacc1 commented May 28, 2023

Hi @camcalaquian,

Consider the following config.yaml

processes:
  A:
    command: "sleep 5"
    depends_on:
      B:
        condition: <condition>
  B:
    command: "sleep 5"

Process A depends on B, it will start based on the following optional conditions:

// ProcessConditionCompleted is the type for waiting until a process has completed (any exit code).
ProcessConditionCompleted = "process_completed"

// ProcessConditionCompletedSuccessfully is the type for waiting until a process has completed successfully (exit code 0).
ProcessConditionCompletedSuccessfully = "process_completed_successfully"

// ProcessConditionHealthy is the type for waiting until a process is healthy.
ProcessConditionHealthy = "process_healthy"

// ProcessConditionStarted is the type for waiting until a process has started (default).
ProcessConditionStarted = "process_started"

@adrian-gierakowski
Copy link
Contributor

I am a little bit worried that it can cause some unintended consequences - someone starting A, but accidentally B will cause some damage.
I probably can add the with dependencies parameter to REST, but in UI it might be annoying to ask it each time.

I think there should definitely be an option to start with deps, but default should be without. There could also be flags at top level, and at process level, to set the default behaviour.

@albertilagan
Copy link

Hi @camcalaquian,

Consider the following config.yaml

processes:
  A:
    command: "sleep 5"
    depends_on:
      B:
        condition: <condition>
  B:
    command: "sleep 5"

Process A depends on B, it will start based on the following optional conditions:

// ProcessConditionCompleted is the type for waiting until a process has completed (any exit code).
ProcessConditionCompleted = "process_completed"

// ProcessConditionCompletedSuccessfully is the type for waiting until a process has completed successfully (exit code 0).
ProcessConditionCompletedSuccessfully = "process_completed_successfully"

// ProcessConditionHealthy is the type for waiting until a process is healthy.
ProcessConditionHealthy = "process_healthy"

// ProcessConditionStarted is the type for waiting until a process has started (default).
ProcessConditionStarted = "process_started"

@F1bonacc1 don't think this works if process is disabled by default. Which is the main concern of this issue I think?

@F1bonacc1
Copy link
Owner

There are several alternatives to consider (not sure which one is the desired behavior):

  1. (TUI) When starting a disabled (or stopped) process ask each time if also start its dependencies. This will also require a REST flag.
  2. Configuration setting per process always_run_with_dependencies - it will be ignored when --no-deps flag is used.
  3. Configuration setting per dependency always_run - it will be ignored when --no-deps flag is used.
  4. Should this behavior apply only to disabled processes or any stopped process?
  5. In case a disabled process is started with its dependencies (TUI/config) should it affect the entire chain or only the immediate child?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants