Skip to content

Conversation

@victoronascimento
Copy link
Contributor

Since Job has all its attributes private to the module, the only way to create a worker or scheduler is to either keep a reference to the queue used in the job creation.

Implementing Into<Worker<Job<I, S>>> and Into<Scheduler<Job<I, S>>> makes it so all we need is the job reference.

Fixes #88

src/job.rs Outdated
}
}

impl<I, S> Into<Worker<Job<I, S>>> for Job<I, S>
Copy link
Owner

Choose a reason for hiding this comment

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

We probably want to implement From for Worker and Scheduler each, since implementing Into directly is discouraged.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm... nice! Sorry my Rust noobism here. I will change it accordingly.

@victoronascimento victoronascimento force-pushed the feat/into_worker_and_scheduler branch from 4c8208a to 5e890a8 Compare April 24, 2025 14:39
@victoronascimento
Copy link
Contributor Author

Done @maxcountryman ! Had to make the queue attribute in Job accessible in the crate. I hope this is ok.

Thanks once again for your guidance on this.

@victoronascimento victoronascimento force-pushed the feat/into_worker_and_scheduler branch from 5e890a8 to 73a5ca4 Compare June 4, 2025 20:13
@victoronascimento
Copy link
Contributor Author

Rebased upon main

Since `Job` has all its attributes private to the module, the only way to create a worker or
scheduler is to either keep a reference to the queue used in the job creation.

Implementing `From<Job<I, S>>` for `Worker` and for `Scheduler` makes it so all we need is the
job reference.
@victoronascimento victoronascimento force-pushed the feat/into_worker_and_scheduler branch from 73a5ca4 to aac91e2 Compare June 5, 2025 12:52
@victoronascimento
Copy link
Contributor Author

Sorry for the noise. Ran every command from the pipeline locally now.

@maxcountryman
Copy link
Owner

@victoronascimento I think #100 will address this, but let me know if not.

@victoronascimento
Copy link
Contributor Author

This is awesome! It certainly address this in a much better way.

Thanks once again for your work!

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.

Expose scheduler/worker creation from Job

2 participants