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

Make restart parallel and add --all #1738

Merged
merged 1 commit into from Nov 1, 2018

Conversation

baude
Copy link
Member

@baude baude commented Oct 31, 2018

When attempting to restart many containers, we can benefit from making
the restarts parallel. For convenience, two new options are added:

--all attempts to restart all containers
--run-only when used with --all will attempt to restart only running containers

Signed-off-by: baude bbaude@redhat.com

Usage: "restart all non-running containers",
},
cli.BoolFlag{
Name: "running-only",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change option to running. I have options with "-" in them.

@rhatdan
Copy link
Member

rhatdan commented Nov 1, 2018

What happens if I specify --running without --all?

@baude
Copy link
Member Author

baude commented Nov 1, 2018

What happens if I specify --running without --all?

I spit an error out that says --running is only valid with all. I would be open to treat --running as if it implied --all. Meaning, you could do restart --running and all running containers would get a restart. And also honor restart --running --all in the same way. WDYT? I kind of like that idea.

@rhatdan
Copy link
Member

rhatdan commented Nov 1, 2018

Yes I would guess --running would imply --all or conflict with --all. I don't think you should need to specify both.

@baude
Copy link
Member Author

baude commented Nov 1, 2018

ok, lets do that, and I will make the option name change too!

@mheon
Copy link
Member

mheon commented Nov 1, 2018

Options change SGTM

Instead of providing the container name or ID, use the last created container. If you use methods other than Podman
to run containers such as CRI-O, the last started container could be from either of those methods.

**--running-only**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just "--running" now me thinks.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Restart all containers that are already in the *running* state.

**--timeout**
Timeout to wait before forcibly stopping the container
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing period

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, if --timeout can be used with --all or --running, should we change to "stopping a container" as there might be multiples and I'm assuming the timeout would apply individually?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK last pick, "Timeout in seconds"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@TomSweeneyRedHat
Copy link
Member

Couple man page nits, otherwise LGTM

@baude
Copy link
Member Author

baude commented Nov 1, 2018

/approve

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: baude

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 1, 2018
}
lastError = errors.Wrapf(err, "error restarting container %s", ctr.ID())
f := func() error {
return con.RestartWithTimeout(context.TODO(), ctrTimeout)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be getContext() instead of context.TODO()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

When attempting to restart many containers, we can benefit from making
the restarts parallel.  For convenience, two new options are added:

--all attempts to restart all containers
--run-only when used with --all will attempt to restart only running containers

Signed-off-by: baude <bbaude@redhat.com>
@mheon
Copy link
Member

mheon commented Nov 1, 2018

LGTM. @rhatdan @TomSweeneyRedHat @umohnani8 PTAL

@mheon
Copy link
Member

mheon commented Nov 1, 2018

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 1, 2018
@openshift-merge-robot openshift-merge-robot merged commit 732a4c8 into containers:master Nov 1, 2018
@baude baude deleted the pararestart branch December 22, 2019 19:01
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 26, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants