Skip to content

Comments

Support Ruby 3#319

Merged
ZimbiX merged 32 commits intoque-rb:masterfrom
greensync:ruby3
Mar 24, 2022
Merged

Support Ruby 3#319
ZimbiX merged 32 commits intoque-rb:masterfrom
greensync:ruby3

Conversation

@oeoeaio
Copy link
Contributor

@oeoeaio oeoeaio commented Dec 16, 2021

NOTE: still in draft

Should resolve #311
Depends on: #334

There is still a bit of cleanup to do yet (commit history is a bit of a mess), but here is a first cut at supporting ruby 3. Builds on the work of @ollym and @siegy22.

Notable changes

  • Database schema has changed to split job arguments into args and kwargs.
  • Passing a hash literal as the last job argument to be splatted into job keyword arguments is no longer supported
  • Dropped support for ruby < 2.7
  • Dropped support for rails < 6.0

TODO

  • Deal with any remaining TODOs in the code
  • Clean up commit history
  • Update readme and docs
  • Add a GIN index on the kwargs column
  • Update documentation for job_options (include searching by .enqueue)
  • Once Add job_schema_version column #334 is merged:
    • Rebase
    • Update the version of the migration here from 5 to 6
    • Start recording job_schema_version as 2 when enqueueing jobs:
      • Bump Que.job_schema_version to 2
      • Remove the job_schema_version column default
  • Remove the old poller index
  • Write upgrade guide for dealing with existing jobs without downtime (running two instances of Que: old and new)
  • Drop gems used to run the test suite against Rubinius
  • Add a NOT NULL constraint to job_schema_version
  • Rename que_poll_idx_with_job_schema_version (from migration 5) to que_poll_idx (after we drop the original)
  • Add a test for passing job options via ActiveJob

@ZimbiX ZimbiX mentioned this pull request Dec 16, 2021
Copy link
Member

@ZimbiX ZimbiX left a comment

Choose a reason for hiding this comment

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

This is looking great. Nice work =)

ZimbiX added a commit that referenced this pull request Dec 23, 2021
Providing a Docker Compose service for running PostgreSQL, with a script for running the tests, makes it a lot easier to get started for developing Que. You no longer need to have installed & started PostgreSQL, set `DATABASE_URL` appropriately, or created a database for Que. Different versions of PostgreSQL can also be tested easily, by setting `POSTGRES_VERSION` - e.g. `auto/test-postgres-14`.

This setup follows GreenSync conventions, although `auto/test` is not used on GitHub Actions.

I've used the latest Ruby Docker image for Ruby 2.7. We can update this to Ruby 3 in #319.
@keithlayne
Copy link

Sorry if I've missed this elsewhere, but what's the target for this? When it's good to go, target v2?

@maddymarkovitz
Copy link
Contributor

@keithlayne wrote:

Sorry if I've missed this elsewhere, but what's the target for this? When it's good to go, target v2?

I think that's the plan. We'd like to release 1.0 after we're satisfied that the current beta release doesn't have any issues, then these changes would come in as 2.0 (after another beta release in between to test them out).

Is Ruby 3 support something you need urgently or are able to test? We want to be guided by the community in terms of developing and documenting an upgrade process.

@keithlayne
Copy link

Thanks for the info. It's not urgent for us, but we're pre-release so I'd be willing to roll with the beta and help with testing and upgrade process. Just hook me up with that early-bird discount.

I think that this is our only dep really holding us back from trying out ruby 3 right now.

@brunoprietog
Copy link

It would be quite nice if it worked with ruby 3. A few months ago I started a project with ruby 3 and it was time to decide on the job library. Que looks very interesting, but it doesn't make me feel good to have to go back to ruby 2.7.
Thanks a lot for the work you guys are doing!

@compactcode
Copy link

compactcode commented Feb 1, 2022

We have switched to this branch for an upcoming ruby 3.1 project at Zepto. Still early days for us but I'm happy to help out with the effort/testing if needed.

@ZimbiX
Copy link
Member

ZimbiX commented Feb 1, 2022

Hi @compactcode, thanks for the offer. Certainly some real-world testing would be great; let us know how you go.

In terms of what's left to do development-wise, it's as @maddymarkovitz said above: we just need to work out a suitable upgrade process from Que 1 for those who can't afford to clear their jobs table. I'm thinking we need to provide the ability to run both Que 1 and Que 2 simultaneously, so that existing jobs (with keyword arguments in the args column rather than kwargs) can be treated appropriately during the transition. Then cut over to Que 2 once all the Que 1 jobs are processed. We'd need a way to determine which jobs need to be handled by which worker - maybe by adding a que version column?

@maddymarkovitz maddymarkovitz force-pushed the ruby3 branch 2 times, most recently from d6a2403 to 78ff282 Compare February 14, 2022 05:44
ZimbiX added a commit that referenced this pull request Feb 19, 2022
Providing a Docker Compose service for running PostgreSQL, with a script for running the tests, makes it a lot easier to get started for developing Que. You no longer need to have installed & started PostgreSQL, set `DATABASE_URL` appropriately, or created a database for Que. Different versions of PostgreSQL can also be tested easily, by setting `POSTGRES_VERSION` - e.g. `auto/test-postgres-14`.

This setup follows GreenSync conventions, although `auto/test` is not used on GitHub Actions.

I've used the latest Ruby Docker image for Ruby 2.7. We can update this to Ruby 3 in #319.
@ZimbiX
Copy link
Member

ZimbiX commented Feb 21, 2022

Rebased to avoid conflicts

@ZimbiX
Copy link
Member

ZimbiX commented Mar 23, 2022

Rebased to avoid conflicts in changelog and version file

ZimbiX added 4 commits March 23, 2022 23:20
Rubinius hasn't had any activity in a couple of years, and it isn't supported by the GitHub Actions ruby/setup-ruby@v1 action anyway.
@ZimbiX
Copy link
Member

ZimbiX commented Mar 23, 2022

Damn, I thought I'd finally finished it, and was about to merge and release, but noticed we hadn't done this so added it to the todo to tackle later:

  • Add a test for passing job options via ActiveJob

@oeoeaio
Copy link
Contributor Author

oeoeaio commented Mar 23, 2022

Damn, I thought I'd finally finished it, and was about to merge and release, but noticed we hadn't done this so added it to the todo to tackle later

  • Add a test for passing job options via ActiveJob

@ZimbiX I think we covered this in 7bcda94

@ZimbiX
Copy link
Member

ZimbiX commented Mar 24, 2022

@ZimbiX I think we covered this in 7bcda94

Ah, excellent; thanks. Looks like we're good to go then! 🚀

@ZimbiX ZimbiX merged commit 528f171 into que-rb:master Mar 24, 2022
@ZimbiX ZimbiX deleted the ruby3 branch March 24, 2022 01:49
yahonda added a commit to yahonda/rails that referenced this pull request Sep 12, 2022
Que and Rails (Active Job QueAdapter) have applied changes each other
to support Ruby 3 keyword arguments and options provided as top level keywords, etc
via these commits:

rails#44734
rails#44248
que-rb/que@d9244b9 via que-rb/que#319

Finally, we've found it is quite difficult to maintain them.
Going forward Active Job Que adapter can be included in the future version of que gem itself.
Refer to rails#45899 the background for this change.

Active Job Que adapter can be included in the future version of que gem itself.
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.

Running que fails with ruby3

9 participants