-
Notifications
You must be signed in to change notification settings - Fork 18
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
[SDK] Fail when using any integrations that aren't connected yet #1223
[SDK] Fail when using any integrations that aren't connected yet #1223
Conversation
global_engine_config = generate_engine_config( | ||
globals.__GLOBAL_API_CLIENT__.list_integrations(), | ||
globals.__GLOBAL_CONFIG__.engine, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-functional change. It just looks better to have the two subgraph statements next to each other.
bbd06a7
to
b4d3694
Compare
c6b91b4
to
bc687b1
Compare
f516f10
to
fb1047e
Compare
bc687b1
to
49fe047
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall is good, left one suggestion to improve the ownership of validate_is_connected
decorator
AnyFunc = Callable[..., Any] | ||
|
||
|
||
def validate_is_connected() -> Callable[[AnyFunc], AnyFunc]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer exposing this as a method in integration base class and have all methods use @self.validate_is_connected()
. In this way the method is tied to the integration and it's clear that we are ensuring 'this' integration is connected. It also avoids passing around self
to an externally imported method (I'm not super sure if it's an antipattern but it feels weird to read :) )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm I don't think I can use the @self.validate_is_connected()
syntax.. My intellij errors and also https://stackoverflow.com/questions/11731136/class-method-decorator-with-self-arguments#:~:text=You%20can't.,use%20a%20different%20method%20entirely.
There's also a bit of a layering issue, where I'd have to move the validate_integration_is_connected()
down to the models/ layer from utils/, which I feel doesn't make too much sense. This is all because the integration classes are defined in integrations/ and the base integration class is defined at a much lower level in models
. I think these layering issues in the SDK should be addressed, but probably not in this PR.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah the current way looks fine then!
@@ -78,7 +78,11 @@ func CreateLambdaFunction(ctx context.Context, functionsToShip []LambdaFunctionT | |||
defer close(pushImageChannel) | |||
AddFunctionTypeToChannel(functionsToShip[:], pullImageChannel) | |||
|
|||
for i := 0; i < MaxConcurrentDownload; i++ { | |||
numPullWorkers := MaxConcurrentDownload |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what are these for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We pull the lambda Docker images from Dockerhub in parallel, this is making sure that the number of workers isn't greater than necessary i believe. @kenxu95 can confirm here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah that's what it's doing. It's just leftover from when I was trying out the lambda stuff, but seemed useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sry, mean't to block until we have clarity on the decorator :)
sdk/aqueduct/models/integration.py
Outdated
self._metadata.exec_state.error.context, | ||
) | ||
) | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there an explicit ExecutionStatus.Pending
status to check for in progress, or is it just that after 2813, all statuses that are None
are considered in progress?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah I don't think this has to do with ENG-2813 - that's just saying that the None case will no longer exist. I don't think we ever have a pending state, we just go directly to running. Can make that a harder assertion here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I decided to simply document this assumption. The assertion seems too aggressive since this isn't a code path we are really testing right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good
some fixes shoot. Maybe it's better to keep it two tables moved it to an integration_connection table, because of editing the migration works. Now to worry about the read and write paths added the drop column one ok now I'm confused. Unwinding back to a single table approach. there are so many thing swrong with this but at least I see a path through now. made some progress. Write path internals in a good state unwound a bunch of stuff prune all the stuff that is unnecessary now Moved the transaction back inside reverted a bunch of stuff back, still need too drop validated column added validated column drop. Ready for testing now. remove dsdk changes last things, lint and block usage of broken integrations. lint done small formatting fixes fixed gh actions made exec_state optional on SDK cr fixed err removed elem context switch made the change for all data integrations done? it's ready. Gonna test update lambda linted and rebased golang lint
c9001d7
to
9b0a8d1
Compare
@likawind re-requesting review to sync on a path forward for the decorator. |
@likawind and @hsubbaraj-spiral as lead reviewers.
Describe your changes and why you are making these changes
A couple SDK improvements in this:
The
integration.describe()
method now shows the status and the error if the integration failed to connect:Methods on integrations that are decorated with @validate_is_connected() will not be allowed to be executed if the integration is not properly connected:
The same thing applies for when we set the engine of an operator to an invalid integration.
Related issue number (if any)
Loom demo (if any)
Checklist before requesting a review
python3 scripts/run_linters.py -h
for usage).run_integration_test
: Runs integration testsskip_integration_test
: Skips integration tests (Should be used when changes are ONLY documentation/UI)