Skip to content

Design: Path Resolver #48

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

Merged
merged 2 commits into from
Dec 21, 2018
Merged

Conversation

sriram-mv
Copy link
Contributor

First pass of design to get comments from the community.

Introduction of two pluggable components.

  • Path Resolver
  • Runtime Validator

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

First pass of design to get comments from the community.

Introduction of two pluggable components.
 * Path Resolver
 * Runtime Validator
Copy link
Contributor

@jfuss jfuss left a comment

Choose a reason for hiding this comment

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

I am having a hard time understanding how (if at all) this impacts the consumer of the library. Will this change be transparent to callers trying to build a given lambda runtime? From the consumer side, can I pass the path to the executable to override the resolving (maybe the validator too) behavior?

How does this design scale? As we add more and more languages/runtimes, will we need to always update something here? Or because we are reading the PATH, as long the executable is available things will "magically" work?

How do we do the Runtime Validation? I am assuming this validation is dependent on the Runtime language specifically. If so, following a factory design might be better than having one class that handles all the validation.

@jfuss jfuss self-assigned this Dec 6, 2018
@sriram-mv
Copy link
Contributor Author

@jfuss What I'm suggesting is that path resolution and validation be part of each workflow, and each workflow brings it own. We just a provide an interface to get an executable and a corresponding path resolver to the BaseWorkflow. This design should scale with every workflow, since it becomes the responsibility of the workflow.

The issue with reading the PATH and magically working is where we sadly run into version conflicts :(
We can issue log info statements in the BaseWorkflow to say this is path to the executable that we are using to atleast clue the consumer of the library onto why we could be failing. This is where I believe the PathValidator needs to be more verbose on why it failed.

The consumer of a workflow can bring their own Validator and path, we might have to rev up the json rpc protocol number and pass additional arguments to the Builder. Infact it may be necessary if the default workflow fails because of path resolution failing.

In terms of users of the library getting impacted: #30 is an example of that. Some of this can also be mitigated by running the build portion in a container.


### Open questions

* Should we constrain the interface for the PathResolver with an abstract base class?
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the pros and cons about this? I think we need an defined interface, at the very least.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pros of this, is that any implementations will need to have appropriate methods defined, so that we dont run into funkiness at runtime. But yeah, I'm just proposing abc as a way to solidly lock down the interface.

self.runtime = runtime
self.executables = [self.runtime, self.language]

def path(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the path allowed to be symlinks or should it be a fully resolved path?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

symlinks should be allowed in my opinion. (helps users have a quick fix to their path, with just changing symlinks)

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess my question is more, is the expectation of the path to be fully resolved or will that happen somewhere else?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Path need not be fully resolved here, the chosen path will be exec'd by the validator to make a decision on the validity of the path, and if it matches the runtime.

@awood45
Copy link
Contributor

awood45 commented Dec 12, 2018

I'm going to look to add Ruby to this after we merge the Ruby build logic. Basically, the following shell one-liner will check compatibility with the ruby2.5 runtime:

ruby -e "unless RUBY_VERSION.match(/2\.5\.\d/); exit(1); end"

@jfuss jfuss merged commit b811288 into aws:develop Dec 21, 2018
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.

3 participants