Skip to content

Conversation

@victorolinasc
Copy link

Hi @maxcountryman !

This is a first pass into adding options to each individual step in a job workflow. I needed this to override task timeouts (in my case I had a long job that was waiting for a task completion).

I know documentation is not yet good and there aren't any tests, but I just wanted to know if this is ok implementation wise. Before merging we will probably need to create a builder to keep the same style and add tests and better documentation.

I thought about adding an option like transaction_in_context: bool but I think this is better suited in another PR because it will be a bit bigger and probably more breaking than this one.

Thanks once again for this great library.

@maxcountryman
Copy link
Owner

At first glance, seems like a reasonable approach.

@victorolinasc
Copy link
Author

Thanks for the fast reply :)

So, to keep this going I will:

  • add tests
  • add a builder for StepOptions

Should it follow the same layout as RetryPolicy and be a module in src/job/step_options.rs? Maybe it makes it easier to maintain like that.

Also, check is failing for something not touched in this PR...

@maxcountryman
Copy link
Owner

It's probably a little easier to keep it in its own module, yes.

@maxcountryman
Copy link
Owner

This isn't something that has to be solved in this PR, but I do want to note that there's a lot of overlap with this new type and the task trait itself; maybe in the future they could share an options struct.

@victorolinasc
Copy link
Author

I see what you mean but I think that the Task trait allows for dynamic code evaluation on the callback while these options are static. I am not sure there is a use case where these options would need to be the result of some code evaluation but, currently, it is possible.

To unify the interfaces I think we would need to either:

  • break the trait dynamic evaluation
  • add a new or build kind of function on the trait that would allow to pass these options

Keeping both might bring some confusion as to which implementation (static or the callback) would have priority.

Anyway, I think I've added a test and the builder so this may be ready for another round of review.

@maxcountryman
Copy link
Owner

This should be rebased on main to pull in the lint fixes.

@maxcountryman maxcountryman requested review from maxcountryman and removed request for maxcountryman November 23, 2025 17:11
@victorolinasc
Copy link
Author

@maxcountryman updated!

@victorolinasc
Copy link
Author

re-formatted with nightly!

StepOptions allow us to override defaults for timeout, heartbeat and so on. It is necessary when you
want to use Context and different timeouts for example.
@victorolinasc
Copy link
Author

Okay. Sorry for the noise... should have run all the checks before.

I believe NOW everything is passing.

@maxcountryman
Copy link
Owner

I'm going to merge this but before cutting a new release I'd like to iterate a bit on the implementation to address duplication between Task and Job. I have an idea but the end result might change the API introduced here somewhat.

@victoronascimento
Copy link
Contributor

Awesome!

I currently point to a private fork and there is no problem about not releasing a new version here.

Thanks a lot for this!

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