Я новичок в Луиджи.
Ниже python (2.7) код, который может успешно выполняться с использованием --local-scheduler. Однако, если запустить под центральным планировщиком, нет ни графика зависимости, ни рабочих. Пожалуйста, совет
Зависимость кода:
Класс AllTasks вызовет класс CountLetters. Класс CountLetters будет считывать значение и длину слова и выводить их в файл с именем word_count.txt (например, apple_count.txt).
python код
class AllTasks(luigi.WrapperTask):
def requires(self):
words = ['apple','banana','grapefruit']
for word in words:
yield CountLetters(word=word)
class CountLetters(luigi.Task):
word=luigi.Parameter()
def output(self):
return luigi.LocalTarget('{}_count.txt'.format(self.word))
def run(self):
with self.output().open('w') as outfile:
outfile.write(
'{word} | {letter_count}\n'.format(
word=self.word,
letter_count=len(self.word)
)
)
if __name__ == "__main__":
luigi.run()
локальный планировщик
PYTHONPATH="." luigi --module luigi_test AllTasks --local-scheduler
DEBUG: Checking if AllTasks() is complete
DEBUG: Checking if CountLetters(word=apple) is complete
DEBUG: Checking if CountLetters(word=banana) is complete
DEBUG: Checking if CountLetters(word=grapefruit) is complete
INFO: Informed scheduler that task AllTasks__99914b932b has status PENDING
INFO: Informed scheduler that task CountLetters_grapefruit_b871f9bf08 has status PENDING
INFO: Informed scheduler that task CountLetters_banana_db7b170113 has status PENDING
INFO: Informed scheduler that task CountLetters_apple_946b133f4a has status PENDING
INFO: Done scheduling tasks
INFO: Running Worker with 1 processes
DEBUG: Asking scheduler for work...
DEBUG: Pending tasks: 4
INFO: [pid 22933] Worker Worker(salt=271153046, workers=1, host=gary.mlp.com, username=root, pid=22933) running CountLetters(word=apple)
INFO: [pid 22933] Worker Worker(salt=271153046, workers=1, host=gary.mlp.com, username=root, pid=22933) done CountLetters(word=apple)
DEBUG: 1 running tasks, waiting for next task to finish
INFO: Informed scheduler that task CountLetters_apple_946b133f4a has status DONE
DEBUG: Asking scheduler for work...
DEBUG: Pending tasks: 3
INFO: [pid 22933] Worker Worker(salt=271153046, workers=1, host=gary.mlp.com, username=root, pid=22933) running CountLetters(word=banana)
INFO: [pid 22933] Worker Worker(salt=271153046, workers=1, host=gary.mlp.com, username=root, pid=22933) done CountLetters(word=banana)
DEBUG: 1 running tasks, waiting for next task to finish
INFO: Informed scheduler that task CountLetters_banana_db7b170113 has status DONE
DEBUG: Asking scheduler for work...
DEBUG: Pending tasks: 2
INFO: [pid 22933] Worker Worker(salt=271153046, workers=1, host=gary.mlp.com, username=root, pid=22933) running CountLetters(word=grapefruit)
INFO: [pid 22933] Worker Worker(salt=271153046, workers=1, host=gary.mlp.com, username=root, pid=22933) done CountLetters(word=grapefruit)
DEBUG: 1 running tasks, waiting for next task to finish
INFO: Informed scheduler that task CountLetters_grapefruit_b871f9bf08 has status DONE
DEBUG: Asking scheduler for work...
DEBUG: Pending tasks: 1
INFO: [pid 22933] Worker Worker(salt=271153046, workers=1, host=gary.mlp.com, username=root, pid=22933) running AllTasks()
INFO: [pid 22933] Worker Worker(salt=271153046, workers=1, host=gary.mlp.com, username=root, pid=22933) done AllTasks()
DEBUG: 1 running tasks, waiting for next task to finish
INFO: Informed scheduler that task AllTasks__99914b932b has status DONE
DEBUG: Asking scheduler for work...
DEBUG: Done
DEBUG: There are no more tasks to run at this time
INFO: Worker Worker(salt=271153046, workers=1, host=gary.mlp.com, username=root, pid=22933) was stopped. Shutting down Keep-Alive thread
INFO:
===== Luigi Execution Summary =====
Scheduled 4 tasks of which:
* 4 ran successfully:
- 1 AllTasks()
- 3 CountLetters(word=apple,banana,grapefruit)
This progress looks :) because there were no failed tasks or missing dependencies
===== Luigi Execution Summary =====
http://localhost: 8082 / статический / визуализатор / индекс. html
luigid
2020-02-28 21:08:56,137 luigi[22994] INFO: logging configured by default settings
2020-02-28 21:08:56,147 luigi.scheduler[22994] INFO: No prior state file exists at /var/lib/luigi-server/state.pickle. Starting with empty state
2020-02-28 21:08:56,156 luigi.server[22994] INFO: Scheduler starting up
2020-02-28 21:09:53,847 tornado.access[22994] INFO: 304 GET /static/visualiser/index.html (::1) 32.42ms
2020-02-28 21:09:53,933 tornado.access[22994] INFO: 304 GET /static/visualiser/css/luigi.css (::1) 1.64ms
2020-02-28 21:09:53,937 tornado.access[22994] INFO: 304 GET /static/visualiser/lib/jquery-1.10.0.min.js (::1) 2.53ms
2020-02-28 21:09:53,942 tornado.access[22994] INFO: 304 GET /static/visualiser/lib/bootstrap3/css/bootstrap.min.css (::1) 2.59ms
2020-02-28 21:09:53,945 tornado.access[22994] INFO: 304 GET /static/visualiser/lib/bootstrap3/css/bootstrap-theme.min.css (::1) 1.85ms
2020-02-28 21:09:53,949 tornado.access[22994] INFO: 304 GET /static/visualiser/lib/bootstrap3/js/bootstrap.min.js (::1) 2.28ms
2020-02-28 21:09:53,953 tornado.access[22994] INFO: 304 GET /static/visualiser/css/tipsy.css (::1) 2.02ms
2020-02-28 21:09:53,956 tornado.access[22994] INFO: 304 GET /static/visualiser/css/font-awesome.min.css (::1) 1.92ms
2020-02-28 21:09:53,960 tornado.access[22994] INFO: 304 GET /static/visualiser/lib/AdminLTE/css/skin-green-light.min.css (::1) 1.94ms
2020-02-28 21:09:53,963 tornado.access[22994] INFO: 304 GET /static/visualiser/lib/datatables/css/jquery.dataTables.min.css (::1) 2.03ms
2020-02-28 21:09:53,968 tornado.access[22994] INFO: 304 GET /static/visualiser/lib/d3/d3.min.js (::1) 2.75ms
2020-02-28 21:09:53,972 tornado.access[22994] INFO: 304 GET /static/visualiser/lib/bootstrap-toggle/css/bootstrap-toggle.min.css (::1) 2.20ms
2020-02-28 21:09:53,975 tornado.access[22994] INFO: 304 GET /static/visualiser/lib/AdminLTE/css/AdminLTE.min.css (::1) 2.07ms
2020-02-28 21:09:53,979 tornado.access[22994] INFO: 304 GET /static/visualiser/lib/d3/dagre-d3.min.js (::1) 2.42ms
2020-02-28 21:09:53,983 tornado.access[22994] INFO: 304 GET /static/visualiser/lib/mustache.js (::1) 2.56ms
2020-02-28 21:09:53,987 tornado.access[22994] INFO: 304 GET /static/visualiser/js/graph.js (::1) 2.39ms
2020-02-28 21:09:53,991 tornado.access[22994] INFO: 304 GET /static/visualiser/js/luigi.js (::1) 2.25ms
2020-02-28 21:09:53,995 tornado.access[22994] INFO: 304 GET /static/visualiser/js/visualiserApp.js (::1) 1.76ms
2020-02-28 21:09:53,998 tornado.access[22994] INFO: 304 GET /static/visualiser/js/tipsy.js (::1) 1.85ms
2020-02-28 21:09:54,001 tornado.access[22994] INFO: 304 GET /static/visualiser/lib/jquery.slimscroll.min.js (::1) 2.32ms
2020-02-28 21:09:54,005 tornado.access[22994] INFO: 304 GET /static/visualiser/lib/AdminLTE/js/app.min.js (::1) 1.86ms
2020-02-28 21:09:54,008 tornado.access[22994] INFO: 304 GET /static/visualiser/lib/datatables/js/jquery.dataTables.min.js (::1) 2.09ms
2020-02-28 21:09:54,013 tornado.access[22994] INFO: 304 GET /static/visualiser/lib/bootstrap-toggle/js/bootstrap-toggle.min.js (::1) 2.51ms
2020-02-28 21:09:54,017 tornado.access[22994] INFO: 304 GET /static/visualiser/lib/URI/1.18.2/URI.js (::1) 2.41ms
2020-02-28 21:09:54,297 tornado.access[22994] INFO: 304 GET /api/has_task_history?data=%7B%7D (::1) 8.48ms
2020-02-28 21:09:54,302 tornado.access[22994] INFO: 304 GET /api/is_pause_enabled?data=%7B%7D (::1) 4.09ms
2020-02-28 21:09:54,309 tornado.access[22994] INFO: 304 GET /api/worker_list?data=%7B%7D (::1) 4.56ms
2020-02-28 21:09:54,313 tornado.access[22994] INFO: 304 GET /api/resource_list?data=%7B%7D (::1) 3.81ms
2020-02-28 21:09:54,428 tornado.access[22994] INFO: 304 GET /static/visualiser/lib/datatables/images/sort_both.png (::1) 2.14ms
2020-02-28 21:09:54,519 tornado.access[22994] INFO: 304 GET /api/task_list?data=%7B%22status%22%3A%22RUNNING%22%2C%22upstream_status%22%3A%22%22%2C%22search%22%3A%22%22%7D (::1) 4.77ms
2020-02-28 21:09:54,525 tornado.access[22994] INFO: 304 GET /api/task_list?data=%7B%22status%22%3A%22BATCH_RUNNING%22%2C%22upstream_status%22%3A%22%22%2C%22search%22%3A%22%22%7D (::1) 4.65ms
2020-02-28 21:09:54,533 tornado.access[22994] INFO: 304 GET /api/task_list?data=%7B%22status%22%3A%22PENDING%22%2C%22upstream_status%22%3A%22UPSTREAM_DISABLED%22%2C%22search%22%3A%22%22%7D (::1) 5.00ms
2020-02-28 21:09:54,538 tornado.access[22994] INFO: 304 GET /api/task_list?data=%7B%22status%22%3A%22FAILED%22%2C%22upstream_status%22%3A%22%22%2C%22search%22%3A%22%22%7D (::1) 4.37ms
2020-02-28 21:09:54,543 tornado.access[22994] INFO: 304 GET /api/task_list?data=%7B%22status%22%3A%22PENDING%22%2C%22upstream_status%22%3A%22UPSTREAM_FAILED%22%2C%22search%22%3A%22%22%7D (::1) 3.77ms
2020-02-28 21:09:54,548 tornado.access[22994] INFO: 304 GET /api/task_list?data=%7B%22status%22%3A%22DISABLED%22%2C%22upstream_status%22%3A%22%22%2C%22search%22%3A%22%22%7D (::1) 4.17ms
2020-02-28 21:09:54,554 tornado.access[22994] INFO: 304 GET /api/task_list?data=%7B%22status%22%3A%22PENDING%22%2C%22upstream_status%22%3A%22%22%2C%22search%22%3A%22%22%7D (::1) 3.73ms
2020-02-28 21:09:54,559 tornado.access[22994] INFO: 304 GET /api/task_list?data=%7B%22status%22%3A%22DONE%22%2C%22upstream_status%22%3A%22%22%2C%22search%22%3A%22%22%7D (::1) 3.68ms
2020-02-28 21:09:54,675 tornado.access[22994] INFO: 304 GET /api/is_paused?data=%7B%7D (::1) 3.77ms
LTV Список задач
График зависимостей LTV
Рабочие LTV