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

[Processor] Block worker allocation if worker allocator is terminated #3092

Merged
merged 8 commits into from
Dec 20, 2023

Conversation

rokatyy
Copy link
Contributor

@rokatyy rokatyy commented Dec 14, 2023

@rokatyy rokatyy marked this pull request as ready for review December 14, 2023 16:30
pkg/processor/worker/allocator.go Show resolved Hide resolved
pkg/platform/kube/test/platform_test.go Outdated Show resolved Hide resolved
@rokatyy rokatyy marked this pull request as draft December 14, 2023 19:13
@github-actions github-actions bot added the ci label Dec 15, 2023
pkg/platform/kube/test/suite.go Outdated Show resolved Hide resolved
pkg/platform/kube/test/suite.go Outdated Show resolved Hide resolved
pkg/processor/worker/allocator.go Show resolved Hide resolved
@rokatyy rokatyy marked this pull request as ready for review December 18, 2023 10:21
Copy link
Contributor

@liranbg liranbg left a comment

Choose a reason for hiding this comment

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

not sure I've seen the flow of what happen after termination flow end? will you be able to allocate worker?

Comment on lines +1707 to +1723
createFunctionOptions.FunctionConfig.Spec.Build.FunctionSourceCode = base64.StdEncoding.EncodeToString([]byte(`
terminated = False
def handler(context, event):
if terminated:
context.logger.info("Got event after termination")
else:
context.logger.info("Got http event")
return "got http event!"

def callback():
import time
time.sleep(3)
terminated = True

def init_context(context):
context.platform.set_termination_callback(callback)
`))
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion -
why not using go embed? would let you write python in x.py and have it linted and etc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@liranbg That's a good idea. I can implement it in another PR and transfer all our raw-code function definitions in tests to embed, just to maintain a holistic approach. What do you think?

pkg/platform/kube/test/platform_test.go Outdated Show resolved Hide resolved
pkg/platform/kube/test/suite.go Show resolved Hide resolved
@rokatyy
Copy link
Contributor Author

rokatyy commented Dec 19, 2023

@liranbg after termination flow, pod fully terminates. Termination flow is invoked on pod termination by termination signals.

@TomerShor TomerShor merged commit b9828b3 into nuclio:development Dec 20, 2023
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants