Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

healthmgr: aurora heron shell controller #2283

Merged
merged 7 commits into from
Sep 6, 2017
Merged

healthmgr: aurora heron shell controller #2283

merged 7 commits into from
Sep 6, 2017

Conversation

huijunwu
Copy link
Member

@huijunwu huijunwu commented Sep 5, 2017

follow #2230:
The healthMgr/Dhalion resolver (RestartContainerResolver) calls Aurora scheduler to restart container. This PR adds a aurora scheduler which does not depend on Aurora CLI and which can be called inside Aurora container.

LOG.severe(e.getMessage());
} catch (IllegalAccessException e) {
LOG.severe(e.getMessage());
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Need we throw an exception if we could not initialize stateMgr and stateMgrAdaptor? Otherwise, the AuroraHeronShellController is in a wrong state.

Copy link
Contributor

Choose a reason for hiding this comment

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

Eventually any exception has to be caught before AuroraScheduler.initialize(). If the exception is not caught here, where shall we catch them?

Copy link
Contributor

@maosongfu maosongfu Sep 6, 2017

Choose a reason for hiding this comment

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

Bubble up a RuntimeException to external logic. Otherwise, the program will execute with a bad state but it is no way executing normally and recovering with such a bad state.

Copy link
Contributor

Choose a reason for hiding this comment

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

done: throw to external logic

}

StMgr contaienrInfo = stateMgrAdaptor.getPhysicalPlan(topologyName).getStmgrs(containerId);
String ip = contaienrInfo.getHostName();
Copy link
Contributor

Choose a reason for hiding this comment

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

call the variable host or hostname. ip is confusing here.

Copy link
Contributor

Choose a reason for hiding this comment

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

done


HttpURLConnection con = NetworkUtils.getHttpConnection(url);
NetworkUtils.sendHttpPostRequest(con, "X", payload.getBytes());
boolean ret = NetworkUtils.checkHttpResponseCode(con, 200);
Copy link
Contributor

Choose a reason for hiding this comment

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

Have a try-catch-finally block and put con.disconnect() in finally

Copy link
Contributor

Choose a reason for hiding this comment

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

done

Context.environ(localConfig),
AuroraContext.getHeronAuroraPath(localConfig),
Context.verbose(localConfig));
switch (klass) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This implementation here is really ugly and bad.
One alternative is to use constant enum;
another alternative is to use a boolean to decide which one to use since you have only two cases and it will fail otherwise.
Polymorphism can be another one.

Copy link
Contributor

Choose a reason for hiding this comment

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

changed to boolean

@@ -71,6 +71,8 @@
PACKING_CLASS ("heron.class.packing.algorithm", Type.STRING),
REPACKING_CLASS ("heron.class.repacking.algorithm", Type.STRING),
STATE_MANAGER_CLASS ("heron.class.state.manager", Type.STRING),
AURORA_CONTROLLER_CLASS ("heron.class.scheduler.aurora.controller",
Copy link
Contributor

Choose a reason for hiding this comment

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

given you have only 2 options, you can consider this is a boolean. You could evolve from it in future if needed, but I seriously doubt that.

Copy link
Contributor

Choose a reason for hiding this comment

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

changed to boolean

@maosongfu
Copy link
Contributor

👍 LGTM

@huijunw
Copy link
Contributor

huijunw commented Sep 6, 2017

thanks @maosongfu

@huijunw huijunw merged commit 3d18239 into apache:master Sep 6, 2017
@huijunwu huijunwu deleted the healthmgrAuroraHeronShellControlelr branch August 21, 2018 09:04
nicknezis pushed a commit that referenced this pull request Sep 14, 2020
* healthmgr add aurora heron-shell controller

* fix style

* wrapper class

* address maosong comment

* address maosong comment: throw excetion to external logic

* update example yaml

* fix style
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants