Skip to content

Commit

Permalink
Fix compatibility with cythonized tasks. (#3246)
Browse files Browse the repository at this point in the history
`types.GeneratorType` is not compatible with the generator type of
Cython. This leads to `_run_get_new_deps()` returning directly when
the task is from a cythonized module and [yields dynamic
dependencies](https://luigi.readthedocs.io/en/stable/tasks.html?highlight=yield#dynamic-dependencies).
  • Loading branch information
MichaelGrupp authored Aug 17, 2023
1 parent 81f13fc commit 9224c0e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions luigi/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"""

import collections
import collections.abc
import datetime
import getpass
import importlib
Expand All @@ -47,7 +48,6 @@
import threading
import time
import traceback
import types

from luigi import notifications
from luigi.event import Event
Expand Down Expand Up @@ -137,7 +137,7 @@ def __init__(self, task, worker_id, result_queue, status_reporter,
def _run_get_new_deps(self):
task_gen = self.task.run()

if not isinstance(task_gen, types.GeneratorType):
if not isinstance(task_gen, collections.abc.Generator):
return None

next_send = None
Expand Down

0 comments on commit 9224c0e

Please sign in to comment.