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

Run worker binary #201

Merged
merged 2 commits into from
Mar 10, 2018
Merged

Run worker binary #201

merged 2 commits into from
Mar 10, 2018

Conversation

rtannenbaum
Copy link
Contributor

Tested running the worker with the Google cloud extension, with our build/run docker script (in config/gcp/)

Currently the Google cloud extension and Microsoft transfer extension are hardcoded since service loading isn't working yet. I left some TODOs for @seehamrun on service loading the extensions.

Left a TODO for flag parsing as well, currently the worker's ExtensionContext is hardcoded to return local config values

#172

Copy link
Collaborator

@holachuy holachuy left a comment

Choose a reason for hiding this comment

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

Very nice!!! A few comments and cleanups


/** Bindings for cloud platform components using Google Cloud Platform. * */
final class GoogleCloudModule extends AbstractModule {
final class GoogleCloudModule extends CloudExtensionModule {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Now or in the next PR, can we name it GoogleCloudExtensionModule for consistency?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point, done

private final ExtensionContext context;

GoogleCloudModule(ExtensionContext context) {
this.context = context;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe as this evolves, we can pass the objects provided by the context to another Constructor so we can test directly

GoogleCloudModule(HttpTransport transport, JSONFactor factory) {
this.transport = transport;
this.factory = factory;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had it that way first actually, I didn't want the params list to get too long as it's manually called, I'm fine with either way though. I'll leave for now and we can always change it later

@@ -26,7 +26,7 @@
import org.slf4j.LoggerFactory;

/** RSA-based implementation for {@link KeyPair} creation and encoding. */
class RsaSymmetricKeyGenerator implements AsymmetricKeyGenerator {
public class RsaSymmetricKeyGenerator implements AsymmetricKeyGenerator {
Copy link
Collaborator

Choose a reason for hiding this comment

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

TODO, provide a public module to bind KeyGenerators

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

/**
* Guice module that must be implemented by Cloud extensions.
*/
public class CloudExtensionModule extends AbstractModule {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we expect subclasses to call super.configure() in their configure() impl?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

whoops, yes, good catch


@Override
public <T> T getService(Class<T> type) {
if (type.equals(HttpTransport.class)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can also put objects in a map keyed by type and then just read from the map here. In the future as the list gets longer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

public <T> T getConfiguration(String key, T defaultValue) {
// TODO parse flags. Returning hardcoded local+GOOGLE config now for testing.
if (key.equals("cloud")) {
return (T) "GOOGLE";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Constant

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's temporarily hardcoded til we parse flags so I'll address this then

@holachuy
Copy link
Collaborator

I'll go ahead and submit it since it's late.

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.

None yet

2 participants