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

[Proposal] Stop all or specific instance of appID with dapr stop command #1260

Closed
pravinpushkar opened this issue Mar 17, 2023 · 9 comments
Closed
Labels
kind/proposal A new proposal to be considered stale

Comments

@pravinpushkar
Copy link
Contributor

pravinpushkar commented Mar 17, 2023

Describe the proposal

Today, daparized apps can be run with any one of the following ways -

  1. Standard dapr run command -
    dapr run --app-id test_1
  2. Multi App Run with run config file -
    dapr run -f dapr.yaml

Here, Users are allowed to run the same command having same --app-id(appID for Multi App Run) multiple times, resulting in having multiple instances of same apps. See the sample dapr list output below when dapr run --app-id test executed 2 times -

Screenshot 2023-03-17 at 10 14 46 AM

When we execute dapr stop --app-id test, it will stop any one of the above instances.

Solution

We can associate all dapr run runs with unique runID which can be of format ${appID}_${randomUniqueID}. With this we can enhance the dapr stop in following way -

  1. dapr stop --app-id appID || dapr stop appID -> Will stop all instances of apps with the same app ID. Basically this command will iterate over all the started apps checking for passed appID and trying to stop. Log cumulative errors to console if there are errors while stopping the apps.
  2. dapr stop --run-id runID -> will stop a particular instance of dapr run. The runID will be stored in metadata and cab fetched from dapr list by users. We can also output the runID in logs for easy reference. It will have two execution paths -
    - try to check if started with run file , then fetch process group ID and send interrupt.
    - else execute the normal stop logic by getting the cliPID or daprdPID.

Originally discussed here in this PR - #1205

Release Note

RELEASE NOTE: ADD Enhance dapr stop to stop all and any particular instances of apps having same appID

@pravinpushkar pravinpushkar added the kind/proposal A new proposal to be considered label Mar 17, 2023
@pravinpushkar pravinpushkar changed the title [Proposal] Stop a specific instance of appID started by same run file or appID [Proposal] Stop all or specific instance of appID with dapr stop command Mar 17, 2023
@mukundansundar
Copy link
Collaborator

mukundansundar commented Mar 17, 2023

@pravinpushkar
Current scenario:
dapr stop --app-id <appID> stops a random app with that ID from the listing.

For enhancements, a couple of points here -

  1. When multiple apps are run with the same appID, from individual dapr run commands, we need a way to identify that unique app that we want to stop and then stop it.
  2. When multiple apps are run with the same appID from a single run template, we need a way to identify that particular instance of app and stop it if needed
  3. We also need a way to stop all apps if needed

The concept of runID would satisfy the requirement 1, but would fail in term of req 2.

For req 3, we should probably have a --all flag in stop to stop all apps with the given appID like dapr stop --app-id <appID> --all.

But for req 1 and req 2 we need a consistent way to stop individual instances of the app since appID is no longer unique.

@pravinpushkar
Copy link
Contributor Author

  1. When multiple apps are run with the same appID from a single run template, we need a way to identify that particular instance of app and stop it if needed

Right, I did not think of this scenario(assumed that a single run file would have all different apps).
If this is the case then we could take the same approach for both the cases(normal dapr run and Multi app run) - Basically get the daprdPID and appPID and send the interrupt for both the process. We have to leave out the process group PID as that would stop all the instances.

For req 3, we should probably have a --all flag in stop to stop all apps with the given appID like dapr stop --app-id <appID> --all.

Why --all flag is needed. We can modify the current behaviour of dapr stop --app-id appID to kill all the instances. Because the current impl itself is not ok.

@dapr-bot
Copy link
Collaborator

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. Thank you for your contributions.

@dapr-bot
Copy link
Collaborator

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. Thank you for your contributions.

@dapr-bot
Copy link
Collaborator

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. Thank you for your contributions.

@dapr-bot dapr-bot added the stale label Jun 19, 2023
@dapr-bot
Copy link
Collaborator

This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as pinned, good first issue, help wanted or triaged/resolved. Thank you for your contributions.

@pravinpushkar pravinpushkar reopened this Jun 26, 2023
@dapr-bot dapr-bot removed the stale label Jun 26, 2023
@dapr-bot
Copy link
Collaborator

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. Thank you for your contributions.

@dapr-bot dapr-bot added stale and removed stale labels Jul 26, 2023
@dapr-bot
Copy link
Collaborator

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. Thank you for your contributions.

@dapr-bot dapr-bot added the stale label Aug 25, 2023
@dapr-bot
Copy link
Collaborator

dapr-bot commented Sep 1, 2023

This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as pinned, good first issue, help wanted or triaged/resolved. Thank you for your contributions.

@dapr-bot dapr-bot closed this as completed Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/proposal A new proposal to be considered stale
Projects
None yet
Development

No branches or pull requests

3 participants