summaryrefslogtreecommitdiff
path: root/tests/test_connection.py
Commit message (Collapse)AuthorAgeFilesLines
* [Hotfix] Fix SSL connection for scheduler (#1894)Cyril Chapellier2023-05-051-6/+10
| | | | | * fix: ssl * fix: reinstate a test for parse_connection
* Worker pool (#1874)Selwin Ong2023-05-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * First stab at implementating worker pool * Use process.is_alive() to check whether a process is still live * Handle shutdown signal * Check worker loop done * First working version of `WorkerPool`. * Added test for check_workers() * Added test for pool.start() * Better shutdown process * Comment out test_start() to see if it fixes CI * Make tests pass * Make CI pass * Comment out some tests * Comment out more tests * Re-enable a test * Re-enable another test * Uncomment check_workers test * Added run_worker test * Minor modification to dead worker detection * More test cases * Better process name for workers * Added back pool.stop_workers() when signal is received * Cleaned up cli.py * WIP on worker-pool command * Fix test * Test that worker pool ignores consecutive shutdown signals * Added test for worker-pool CLI command. * Added timeout to CI jobs * Fix worker pool test * Comment out test_scheduler.py * Fixed worker-pool in burst mode * Increase test coverage * Exclude tests directory from coverage.py * Improve test coverage * Renamed `Pool(num_workers=2) to `Pool(size=2)` * Revert "Renamed `Pool(num_workers=2) to `Pool(size=2)`" This reverts commit a1306f89ad0d8686c6bde447bff75e2f71f0733b. * Renamed Pool to WorkerPool * Added a new TestCase that doesn't use LocalStack * Added job_class, worker_class and serializer arguments to WorkerPool * Use parse_connection() in WorkerPool.__init__ * Added CLI arguments for worker-pool * Minor WorkerPool and test fixes * Fixed failing CLI test * Document WorkerPool
* Added parse_connection function (#1884)Selwin Ong2023-04-251-1/+11
| | | | | | | | | | | * Added parse_connection function * feat: allow custom connection pool class (#1885) * Added test for SSL --------- Co-authored-by: Cyril Chapellier <tchapi@users.noreply.github.com>
* Remove `use_connection` (#1859)lowercase002023-03-071-31/+2
| | | | | * feat: remove use_connection * fix: clear old test
* Drop python2-specific syntax (#1674)Hugo2022-07-241-4/+0
| | | | | | | * Drop syntax required only for Python 2 * Drop python2-style super() calls Co-authored-by: Selwin Ong <selwin.ong@gmail.com>
* Fixes Job.fetch when return value is unpickleable (#1184)Selwin Ong2020-01-311-2/+4
| | | | | | * Fixes Job.fetch when return value is unpickleable * Fixed connection test in newer versions of Redis
* Fixed #870 Improved test coverage for connections.py and utils.pyTheo2017-08-311-1/+29
|
* fix testsahxxm2015-11-091-4/+4
| | | | | syntax: assertEquals -> assertEqual, assertNotEquals -> assertNotEqual usage: status of worker and job now will use get/set method instead of property method
* Enable the most modern Python syntax.Vincent Driessen2014-05-051-3/+7
|
* New connection management.Vincent Driessen2012-03-231-0/+36
Connections can now be set explicitly on Queues, Workers, and Jobs. Jobs that are implicitly created by Queue or Worker API calls now inherit the connection of their creator's. For all RQ object instances that are created now holds that the "current" connection is used if none is passed in explicitly. The "current" connection is thus hold on to at creation time and won't be changed for the lifetime of the object. Effectively, this means that, given a default Redis connection, say you create a queue Q1, then push another Redis connection onto the connection stack, then create Q2. In that case, Q1 means a queue on the first connection and Q2 on the second connection. This is way more clear than it used to be. Also, I've removed the `use_redis()` call, which was named ugly. Instead, some new alternatives for connection management now exist. You can push/pop connections now: >>> my_conn = Redis() >>> push_connection(my_conn) >>> q = Queue() >>> q.connection == my_conn True >>> pop_connection() == my_conn Also, you can stack them syntactically: >>> conn1 = Redis() >>> conn2 = Redis('example.org', 1234) >>> with Connection(conn1): ... q = Queue() ... with Connection(conn2): ... q2 = Queue() ... q3 = Queue() >>> q.connection == conn1 True >>> q2.connection == conn2 True >>> q3.connection == conn1 True Or, if you only require a single connection to Redis (for most uses): >>> use_connection(Redis())