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

Get additional info for a job #409

Closed
ivan-kolesov opened this issue Jun 27, 2022 · 10 comments
Closed

Get additional info for a job #409

ivan-kolesov opened this issue Jun 27, 2022 · 10 comments
Labels

Comments

@ivan-kolesov
Copy link

Is it possible to get additional information about a running task: scheduled start time, number of iterations, task status (pending, running, completed)? If it were possible to obtain an instance of SqOperation publicly, then this question would not exist.

@lucas34
Copy link
Owner

lucas34 commented Jun 28, 2022

You can use JobListener and react based on different events

@ivan-kolesov
Copy link
Author

You can use JobListener and react based on different events

Tried to play with JobListener, but can't get nextRunSchedule that handles SqOperation only.

@lucas34
Copy link
Owner

lucas34 commented Jun 29, 2022

What does nextRunSchedule means ?

@ivan-kolesov
Copy link
Author

ivan-kolesov commented Jun 29, 2022

nextRunSchedule

This means when the next time job will start based on scheduled time. Because retry delay might be linear or exponential and no any way to determine the delay inside a job.

@lucas34
Copy link
Owner

lucas34 commented Jun 29, 2022

If you want the info in the internal logger I think we can add it.

Otherwise I suggest you implement your custom Retry Constraint using

 JobBuilder(type: type)
                .add(constraint: MyCustomRetryConstraint())
                .schedule(manager: manager)

If your job require serialisation make sure your MyCustomRetryConstraint implement CodableConstraint. And in your deserialiser you need to inject the MyCustomRetryConstraint inside the constraint factory from DecodableSerializer

DecodableSerializer(maker: MyCustomConstraintMaker())

@ivan-kolesov
Copy link
Author

Thanks, I want to see the info not in internal logger, but somewhere as you offered, in JobListener.
If I implement a custom constraint will the constraint persist in the storage where job saves?

@lucas34
Copy link
Owner

lucas34 commented Jul 1, 2022

Yes if your custom constraint extends CodableConstraint.
Also you will need a custom ConstraintMaker to re-add the custom constraint when deserialiser.

All internal constraints Are also created using this mechanism

@stale
Copy link

stale bot commented Jul 8, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@ivan-kolesov
Copy link
Author

Retry Constraint is marked as final, and it's not a good idea cloning the constraint for modifying a few lines

@stale
Copy link

stale bot commented Jul 21, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jul 21, 2022
@stale stale bot closed this as completed Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants