4

I have am triggering Luigi via

luigi.run(["--local-scheduler"], main_task_cls=Test(Server = ActiveServer, Database = DB))   

and in my class I have:

class Test(luigi.Task):

    Database = luigi.Parameter()
    Server = luigi.Parameter()

but the task test can't seem to parse the parameters that I'm feeding it properly?

I am getting:

MissingParameterException: No value for 'Server' (--Server) submitted and no default value has been assigned.
KillerSnail
  • 2,637
  • 5
  • 39
  • 59
  • Did @Samuel-Lampa answer your question? – Dan Garthwaite Oct 16 '15 at 20:06
  • In case someone comes across to run luigi from python run time it's `luigi.build([Test('db','svr')], local_scheduler=True)` see [https://stackoverflow.com/questions/41876861/how-to-use-parameters-in-python-luigi](https://stackoverflow.com/questions/41876861/how-to-use-parameters-in-python-luigi) – citynorman Oct 12 '17 at 00:57

1 Answers1

7

As far as I know, you can not send the parameters through the main_task_cls argument, only the class itself. Parameters could instead be sent via the cmdline_args argument, like so:

luigi.run(
    cmdline_args=["--local-scheduler",
                  "--server=ActiveServer",
                  "--database=DB"], 
    main_task_cls=Test)

Note also that there is the local_scheduler keyword argument to luigi.run() that you can use instead of sending --local-scheduler through the cmdline_args argument, so you get:

luigi.run(
    cmdline_args=["--Server=ActiveServer",
                  "--Database=DB"], 
    main_task_cls=Test
    local_scheduler=True)
Samuel Lampa
  • 4,146
  • 4
  • 37
  • 62