def test_tubes(c: Client) -> None: assert c.tubes() == ['default'] c.use('a') assert set(c.tubes()) == {'default', 'a'} c.watch('b') c.watch('c') assert set(c.tubes()) == {'default', 'a', 'b', 'c'}
def test_tubes(c: Client) -> None: assert c.tubes() == ["default"] c.use("a") assert set(c.tubes()) == {"default", "a"} c.watch("b") c.watch("c") assert set(c.tubes()) == {"default", "a", "b", "c"}
def max_current_jobs_ready(client: greenstalk.Client, tubes: List[Text]) -> int: """Get max current-jobs-ready from tubes specified""" max_jobs = 0 for tube in tubes: # We need to check for the existense of a beanstalk tube # to avoid "NOT_FOUND" exceptions in the case where the tubes # are empty before first init if tube not in client.tubes(): continue stats = client.stats_tube(tube) if stats: max_jobs = max(max_jobs, stats.get("current-jobs-ready", 0)) return max_jobs