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

check for annotated file as entrypoint #225

Merged
merged 2 commits into from
Feb 14, 2023
Merged

check for annotated file as entrypoint #225

merged 2 commits into from
Feb 14, 2023

Conversation

jhsinger-klotho
Copy link
Contributor

• Does any part of it require special attention?
• Does it relate to or fix any issue?

We have a slight bug with proxy + pruning combo due to the addition of source files instead of entrypoints. This is because when we dont have the annotated files added as entry points we then prune everything since thats how the dependecy resolver is based.

Standard checks

  • Unit tests: Any special considerations?
  • Docs: Do we need to update any docs, internal or public?
  • Backwards compatibility: Will this break existing apps? If so, what would be the extra work required to keep them working?

cap := annot.Capability
if cap.Name == annotation.ExecutionUnitCapability && cap.ID == unit.Name {
if len(unit.Executable.Entrypoints) == 1 {
return core.WrapErrf(err, "entrypoint resolution failed for execution unit: %s. Too many annotated files with the same execution unit ID", unit.Name)
Copy link
Contributor

Choose a reason for hiding this comment

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

Multiple files with the same execution unit ID is not an error. Remember that what currently distinguishes an Entrypoint from a SourceFile is that Entrypoints are used as roots for the file dependency graph.

(same goes for the other languages)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

whats the use case with multiple lang files with the same exec unit id?

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 can definitely remove this but i wasnt able to think of a reason why we should allow it

Copy link
Contributor

Choose a reason for hiding this comment

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

A case where a file (and its dependencies) are utilized by the execution unit, but are imported/loaded dynamically rather than statically somewhere in the execution unit. This could be directly in the user's code or via a supported framework/application server that executes the user's source code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hm, but we arent parsing and reading in those dynamic files are we? im fine removing it for now, but im curious to hear your thoughts and revisit this later

Copy link
Contributor

Choose a reason for hiding this comment

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

The files aren't dynamically generated, just their usage. An example of this might be a Django migration script. It's not going to be imported anywhere in your application, but when you need to execute it with the django-admin CLI in a cloud environment, you need a way to ensure that it's included in an execution unit. The annotation is an easy way to accomplish this (though there may be a more optimal/ideal solution).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh thats fair. Yeah i figure an extension of execution may be beneficial if its something that needs to be run before boot, but i guess if it needs to be run on the side then yeah this would work

@github-actions
Copy link

Package Line Rate Health
github.com/klothoplatform/klotho/pkg/analytics 2%
github.com/klothoplatform/klotho/pkg/annotation 23%
github.com/klothoplatform/klotho/pkg/cli 4%
github.com/klothoplatform/klotho/pkg/core 21%
github.com/klothoplatform/klotho/pkg/env_var 82%
github.com/klothoplatform/klotho/pkg/exec_unit 54%
github.com/klothoplatform/klotho/pkg/infra/kubernetes 59%
github.com/klothoplatform/klotho/pkg/infra/kubernetes/helm 39%
github.com/klothoplatform/klotho/pkg/input 63%
github.com/klothoplatform/klotho/pkg/lang 38%
github.com/klothoplatform/klotho/pkg/lang/dockerfile 0%
github.com/klothoplatform/klotho/pkg/lang/golang 29%
github.com/klothoplatform/klotho/pkg/lang/javascript 48%
github.com/klothoplatform/klotho/pkg/lang/python 61%
github.com/klothoplatform/klotho/pkg/lang/yaml 0%
github.com/klothoplatform/klotho/pkg/logging 6%
github.com/klothoplatform/klotho/pkg/multierr 95%
github.com/klothoplatform/klotho/pkg/provider/aws 59%
github.com/klothoplatform/klotho/pkg/runtime 78%
github.com/klothoplatform/klotho/pkg/static_unit 33%
github.com/klothoplatform/klotho/pkg/validation 73%
github.com/klothoplatform/klotho/pkg/yaml_util 79%
Summary 41% (3891 / 9495)

@jhsinger-klotho jhsinger-klotho merged commit 28ca217 into main Feb 14, 2023
@jhsinger-klotho jhsinger-klotho deleted the entrypoint branch February 14, 2023 00:15
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.

2 participants