Launching a Luigi task from cmd - "No modules with task names"

I'm having problems completing a Luigi task using Windows cmd. Here are the facts:

  • Running Anaconda installed in C: \ ProgramData \ Anaconda2 (Python 2.7)

  • Anaconda has added its paths to the PATH variable, but there is no PYTHONPATH variable

  • The task I'm trying to run is in C:\....\tasks.py

  • Trying to run it like this:

    C: \ .... luigi - module tasks MyTask --dt 20170316
    ImportError: No module with task names

I tried to create a variable PYTHONPATHand add the exact path to the directory containing my file tasks.py, but it did not work. Another problem that I am facing may be related to the fact that I run the luigi scheduler via cmd using:

luigid

it works fine, but whenever I try to run it using:

luigid --background

I get the following error:

No module named pwd

It seems that something is wrong with my setup in general, any help would be appreciated.

+4
source share
2 answers

Take the directory examplesin the repository luigi( git clone ...and you have a directory luigi). There you can find several different examples, among which are:

  • hello_world.pycontains things like task_namespace = 'examples'(the same as the python module examplesin the repository where all these python files are stored):
    • this can be done using a command luigi(no need to have a daemon luigid) from outside the python module exampleslike:cd luigi && PYTHONPATH=. luigi --module examples.hello_world examples.HelloWorldTask --local-scheduler
  • top_artists.py , task_namespace:
    • python examples: cd luigi/examples && PYTHONPATH='.' luigi --module top_artists AggregateArtists --local-scheduler --date-interval 2012-06

miniconda ( anaconda) cygwin, , , cygwin strong > (, powershell cmd &&, ).

/, hello_world.py cd luigi/examples && PYTHONPATH=. luigi --module hello_world HelloWorldTask --local-scheduler ( , luigi examples. ), :

raise TaskClassNotFoundException(cls._missing_task_msg(name))
luigi.task_register.TaskClassNotFoundException: No task HelloWorldTask. Candidates are: Config,ExternalTask,RangeBase,RangeByMinutes,RangeByMinutesBase,RangeDaily,RangeDailyBase,RangeHourly,RangeHourlyBase,Task,TestNotificationsTask,WrapperTask,batch_email,core,email,examples.HelloWorldTask,execution_summary,retcode,scheduler,sendgrid,smtp,worker

, , cygwin : luigid &. . , PID , cygwin, ps aux | grep luigid. , , cygwin (- bash ).

+3

. , , , sys.path WINDOWS TERMINAL/CMD/- , python, :

set PYTHONPATH=%cd%;%PYTHONPATH%

​​ PYTHONPATH. PYTHONPATH , .
luigi.

luigi --module tasks MyTask --local-scheduler

, PYTHONPATH PATH, :

set PATH=%PYTHONPATH%;%PATH%

​​ PYTHONPATH, . Windows.

+1

Source: https://habr.com/ru/post/1672495/


All Articles