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

added local decorator #1824

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vardhaman-surana
Copy link

@vardhaman-surana vardhaman-surana commented May 6, 2024

for issue: #350

  1. added a new decorator: @local
  2. this will force steps to run locally even when doing --with batch and --with kubernetes, by preventing attachment of batch and kubernetes decorators to the steps which have @local attached to them already.

@vardhaman-surana vardhaman-surana marked this pull request as ready for review May 7, 2024 09:23
@vardhaman-surana vardhaman-surana changed the title [WIP] added local decorator added local decorator May 7, 2024
@@ -481,6 +483,12 @@ def _attach_decorators_to_step(step, decospecs):
deconame = splits[0]
if deconame not in decos:
raise UnknownStepDecoratorException(deconame)

Copy link
Contributor

Choose a reason for hiding this comment

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

I have a few issues with this and I don't, unfortunately, have an ideal solution for it yet. I don't want to put specific decorators here (in core). There are other decorators that local could impact (for example, at Netflix, we have a @titus decorator). Ideally we would have a better way for decorators to communicate between each other (or something).

One thing that I think may be better (but @savingoyal could also comment) is actually putting stuff in the batch and kubernetes decorator and have them "disable" themselves if they see that local is present. I think that type of change may be more palatable and puts less stuff in the core.

Copy link
Author

Choose a reason for hiding this comment

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

I can work on implementing a solution to have batch and Kubernetes operators disable themselves when local decorator is present. Should I proceed with this approach?

Copy link
Author

Choose a reason for hiding this comment

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

if i don't put condition directly in the attach_decorators function and add a method (let's say should_attach(step)) in base StepDecorator which always return true.
and override that in BatchDecorator and KubernetesDecorator class to check for the local decorator presence...
would that be acceptable ?
and that method can be evaluated in attach_decorators before attaching any decorator.
Again this will be a change in the core but i guess it will make the chances of breaking other things less.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll let @savingoyal chime in. I think the least intrusive one is just:

  • add a local decorator
  • have the batch/kube/etc decorators check for the presence of the local decorator and disable themselves if present

This doesn't add much to core (apart from the local decorator) and we can then properly evolve it. We are looking at redesigning the decorator interfaces as well so this can probably be a part of that. In the meantime, this seems like a small enough solution. We could even get a tad fancier and check if the decorators are static or not (added with --with batch) and error if there is local and batch statically there.

Copy link
Author

Choose a reason for hiding this comment

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

@savingoyal should i proceed with adding should_attach function in stepDecorator ?
@romain-intel i was trying to disable batch and kubernetes decorators from within themselves but it seems that approach will require changes in each function of those decorators which are called as per the workflow of decorators.

@savingoyal savingoyal self-requested a review May 9, 2024 17:40
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