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

CODENVY-212: Add DockerContainerCleaner for clean up docker containers #1104

Merged
merged 1 commit into from
May 11, 2016

Conversation

AndrienkoAleksandr
Copy link
Contributor

Signed-off-by: Aleksandr Andrienko aandrienko@codenvy.com

@@ -168,6 +171,41 @@ public Version getVersion() throws IOException {
}

/**
* Method returns list docker containers which wos filtered by query parameters from {@link ListContainersParams}

Choose a reason for hiding this comment

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

Typo: wos

@garagatyi
Copy link

Add yourself as author

verify(dockerConnector, never()).killContainer(containerId2);
verify(dockerConnector, never()).removeContainer(containerId2, true, true);
}
}

Choose a reason for hiding this comment

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

Please add trailing new line at the end of file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Trailing new line added

@AndrienkoAleksandr AndrienkoAleksandr changed the title CODENVY-212: Add DockerContainerCleaner for clean up docker containers [WIP] CODENVY-212: Add DockerContainerCleaner for clean up docker containers Apr 22, 2016
@AndrienkoAleksandr
Copy link
Contributor Author

Pull request updated. @garagatyi @sleshchenko review please.


@ScheduleRate(period = 5, initialDelay = 5, unit = TimeUnit.MINUTES)//it will be changed to one per hour. Maybe it should be set in property ?
@Override
public void run() {
Copy link
Member

@sleshchenko sleshchenko Apr 22, 2016

Choose a reason for hiding this comment

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

I would recommend add catch (Exception ...) to avoid suppressing of next subsequent executions in case throwing RuntimeException

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, thank you.

@AndrienkoAleksandr
Copy link
Contributor Author

Pull request updated. Moved job period to the properties file.

@@ -70,6 +70,7 @@ docker.registry.auth.password=NULL
docker.registry.auth.email=NULL
docker.connection.tcp.connection_timeout_ms=600000
docker.connection.tcp.read_timeout_ms=600000
docker.clean.up.unused.containers.period_min=5

Choose a reason for hiding this comment

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

It is good that you've added unit to property name. But naming is not the best. We use dots to separate components and underscores to separate words of one component.

@codenvy-ci
Copy link

Build finished.

addQueryParamIfNotNull(connection, "since", params.getSince());
addQueryParamIfNotNull(connection, "before", params.getBefore());
if (filters != null) {
connection.query("filters", urlPathSegmentEscaper().escape(JsonHelper.toJson(params.getFilters())));

Choose a reason for hiding this comment

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

Either use local variable you've previously set or don't create that variable at all

@codenvy-ci
Copy link

Build finished.

return new Object[][] {{"/workspacep2bivvctac5ciwoh_machineri6bxnoj5jq7ll9j_user-name_ws-machine-name",
new Pair<>("machineri6bxnoj5jq7ll9j", "workspacep2bivvctac5ciwoh")},

{"/workspacep2bivvctac5ciwoh_machineri6bxnoj5jq7ll9j_user-name_ws-machine-name",

Choose a reason for hiding this comment

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

include example with Swarm's node name at the beggining

@codenvy-ci
Copy link

Build finished.

@AndrienkoAleksandr
Copy link
Contributor Author

Updated. @garagatyi review please.

@garagatyi
Copy link

Please perform final tests with docker and swarm

@garagatyi
Copy link

LGTM

@@ -185,7 +189,48 @@ public Version getVersion() throws IOException {
if (OK.getStatusCode() != response.getStatus()) {
throw getDockerException(response);
}
return parseResponseStreamAsListAndClose(response.getInputStream());
return parseResponseStreamAsListAndClose(response.getInputStream(), new TypeToken<List<Image>>() {}.getType());
Copy link
Contributor

@voievodin voievodin May 6, 2016

Choose a reason for hiding this comment

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

There is no need to create new instance of TypeToken each time when you list the images

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we move creation this TypeToken to the field we should do that for all methods, which used method parseResponseStreamAsListAndClose (for now we have two such methods, but it can be more). I think method parseResponseStreamAsListAndClose should be ease of use, so we should not create new fields for TypeToken in the docker connector.

@codenvy-ci
Copy link

Build finished.

2 similar comments
@codenvy-ci
Copy link

Build finished.

@codenvy-ci
Copy link

Build finished.

@skabashnyuk
Copy link
Contributor

ok

@AndrienkoAleksandr AndrienkoAleksandr changed the title [WIP] CODENVY-212: Add DockerContainerCleaner for clean up docker containers CODENVY-212: Add DockerContainerCleaner for clean up docker containers May 10, 2016
@codenvy-ci
Copy link

Build finished.

Signed-off-by: Aleksandr Andrienko <aandrienko@codenvy.com>
@codenvy-ci
Copy link

Build finished.

@AndrienkoAleksandr AndrienkoAleksandr merged commit 5aac669 into master May 11, 2016
@AndrienkoAleksandr AndrienkoAleksandr deleted the CODENVY-212-2 branch May 11, 2016 05:00
@codenvy-ci
Copy link

Build finished.

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

Successfully merging this pull request may close these issues.

8 participants