automl.workflows package

Submodules

automl.workflows.admin module

class AutomlCommandModule(engine)

Bases: dlmed.hci.reg.CommandModule

get_spec()
handle_abort_worker()
handle_list_workers()
handle_resume_worker()
handle_show_worker()
handle_stop()
handle_suspend_worker()
start_admin(engine, admin_port, ctx: automl.defs.Context)

automl.workflows.defs module

class WorkerConfig

Bases: object

Define structure of Worker Configuration.

Parameters
  • name – the name of the worker

  • gpus – list of GPU IDs to be used by the worker

gpu_list_string()

automl.workflows.engine module

class Engine

Bases: object

The AutoML workflow engine.

Parameters
  • worker_configs – list of worker configurations

  • controller – the controller object

  • executor – the executor object

  • handlers – list of AutoML handlers

  • job_poll_interval – polling interval for getting finished jobs

ask_to_stop()
run(ctx: automl.defs.Context)

Run the workflow engine.

Parameters

ctx – AutoML main context

Returns:

shutdown(ctx: automl.defs.Context)

Shutdown the workflow engine. It calls the shutdown methods of controller, executor and all handlers.

Parameters

ctx – the main context

Returns:

automl.workflows.test_engine module

class TestController(total_recs, max_recs_each_time)

Bases: automl.components.controllers.controller.Controller

initial_recommendation()

This method is called by the AutoML workflow engine to produce the initial set of recommendations. The controller must produce 1 or more recommendations. If no recommendation is produced, the AutoML workflow will stop immediately.

This method is called only once at the beginning of the AutoML process.

Parameters

ctx – the context that enables across-component data sharing and communication

Returns: a list of recommendations

refine_recommendation()

This method is called by the AutoML workflow engine to produce a set of recommendations based on the result from a previous job.

The controller can produce 0 or more recommendations.

This method is called every time a job finishes executing a previous recommendation.

Parameters
  • outcome – the result of executing the previous recommendation

  • ctx – the context that enables across-component data sharing and communication

Returns: a list of recommendations, could be empty

set_search_space(space: automl.defs.SearchSpace, ctx: automl.defs.Context)

Set the search space. This is the search space that the controller will search against to produce recommendations. The controller must keep it for later use.

Parameters
  • space – the search space

  • ctx – the context that enables across-component data sharing and communication

Returns:

NOTE: the controller should validate the search space and makes sure it is acceptable. In case the search space is not acceptable, the controller should either raise an exception or ask to stop the workflow by calling: ctx.ask_to_stop().

class TestExecutor

Bases: automl.components.executors.executor.Executor

determine_search_space(ctx: automl.defs.Context) automl.defs.SearchSpace

This method is called by the AutoML engine to determine the AutoML search space. This method is called from the Main Thread.

Parameters

ctx – the context that enables cross-component data sharing

Returns: a search space

execute(recommendation: automl.defs.Recommendation, ctx: automl.defs.Context) object

Execute the specified recommendation and return a score.

This method is called from the Job Thread.

Parameters
  • recommendation – the recommendation to be executed

  • ctx – the context that enables cross-component data sharing

Returns: an object that represents the score

class TestHandler

Bases: automl.components.handlers.handler.Handler

handle_event(event: str, ctx: automl.defs.Context)

The default event handler that calls a predefined method for each event type.

Parameters
  • event – event to be handled

  • ctx – context for cross-component data sharing

Returns:

main()

Module contents