luigi.server module

Simple REST server that takes commands in a JSON payload Interface to the Scheduler class. See Using the Central Scheduler for more info.

class luigi.server.cors(*args, **kwargs)[source]

Bases: luigi.task.Config

enabled = BoolParameter (defaults to False): Enables CORS support.
allow_any_origin = BoolParameter (defaults to False): Accepts requests from any origin.
allow_null_origin = BoolParameter (defaults to False): Allows the request to set `null` value of the `Origin` header.
max_age = IntParameter (defaults to 86400): Content of `Access-Control-Max-Age`.
allowed_methods = Parameter (defaults to GET, OPTIONS): Content of `Access-Control-Allow-Methods`.
allowed_headers = Parameter (defaults to Accept, Content-Type, Origin): Content of `Access-Control-Allow-Headers`.
exposed_headers = Parameter (defaults to ): Content of `Access-Control-Expose-Headers`.
allow_credentials = BoolParameter (defaults to False): Indicates that the actual request can include user credentials.
allowed_origins = ListParameter (defaults to []): A list of allowed origins. Used only if `allow_any_origin` is false.
class luigi.server.RPCHandler(*args, **kwargs)[source]

Bases: tornado.web.RequestHandler

Handle remote scheduling calls using rpc.RemoteSchedulerResponder.

initialize(scheduler)[source]

Hook for subclass initialization. Called for each request.

A dictionary passed as the third argument of a url spec will be supplied as keyword arguments to initialize().

Example:

class ProfileHandler(RequestHandler):
    def initialize(self, database):
        self.database = database

    def get(self, username):
        ...

app = Application([
    (r'/user/(.*)', ProfileHandler, dict(database=database)),
    ])
options(*args)[source]
get(method)[source]
post(method)
class luigi.server.BaseTaskHistoryHandler(application, request, **kwargs)[source]

Bases: tornado.web.RequestHandler

initialize(scheduler)[source]

Hook for subclass initialization. Called for each request.

A dictionary passed as the third argument of a url spec will be supplied as keyword arguments to initialize().

Example:

class ProfileHandler(RequestHandler):
    def initialize(self, database):
        self.database = database

    def get(self, username):
        ...

app = Application([
    (r'/user/(.*)', ProfileHandler, dict(database=database)),
    ])
get_template_path()[source]

Override to customize template path for each handler.

By default, we use the template_path application setting. Return None to load templates relative to the calling file.

class luigi.server.AllRunHandler(application, request, **kwargs)[source]

Bases: luigi.server.BaseTaskHistoryHandler

get()[source]
class luigi.server.SelectedRunHandler(application, request, **kwargs)[source]

Bases: luigi.server.BaseTaskHistoryHandler

get(name)[source]
luigi.server.from_utc(utcTime, fmt=None)[source]

convert UTC time string to time.struct_time: change datetime.datetime to time, return time.struct_time type

class luigi.server.RecentRunHandler(application, request, **kwargs)[source]

Bases: luigi.server.BaseTaskHistoryHandler

get()[source]
class luigi.server.ByNameHandler(application, request, **kwargs)[source]

Bases: luigi.server.BaseTaskHistoryHandler

get(name)[source]
class luigi.server.ByIdHandler(application, request, **kwargs)[source]

Bases: luigi.server.BaseTaskHistoryHandler

get(id)[source]
class luigi.server.ByParamsHandler(application, request, **kwargs)[source]

Bases: luigi.server.BaseTaskHistoryHandler

get(name)[source]
class luigi.server.RootPathHandler(application, request, **kwargs)[source]

Bases: luigi.server.BaseTaskHistoryHandler

get()[source]
head()[source]

HEAD endpoint for health checking the scheduler

class luigi.server.MetricsHandler(application, request, **kwargs)[source]

Bases: tornado.web.RequestHandler

initialize(scheduler)[source]

Hook for subclass initialization. Called for each request.

A dictionary passed as the third argument of a url spec will be supplied as keyword arguments to initialize().

Example:

class ProfileHandler(RequestHandler):
    def initialize(self, database):
        self.database = database

    def get(self, username):
        ...

app = Application([
    (r'/user/(.*)', ProfileHandler, dict(database=database)),
    ])
get()[source]
luigi.server.app(scheduler)[source]
luigi.server.run(api_port=8082, address=None, unix_socket=None, scheduler=None)[source]

Runs one instance of the API server.

luigi.server.stop()[source]