automl.workflows package
-
class
AutomlCommandModule
(engine) Bases:
dlmed.hci.reg.CommandModule
-
get_spec
()
-
handle_abort_worker
(conn: dlmed.hci.conn.Connection, args: [] )
-
handle_list_workers
(conn: dlmed.hci.conn.Connection, args: [] )
-
handle_resume_worker
(conn: dlmed.hci.conn.Connection, args: [] )
-
handle_show_worker
(conn: dlmed.hci.conn.Connection, args: [] )
-
handle_stop
(conn: dlmed.hci.conn.Connection, args: [] )
-
handle_suspend_worker
(conn: dlmed.hci.conn.Connection, args: [] )
-
-
start_admin
(engine, admin_port, ctx: automl.defs.Context)
-
class
WorkerConfig
(name: str, gpus: [] ) 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
()
-
class
Engine
(worker_configs: [], controller: automl.components.controllers.controller.Controller, executor: automl.components.executors.executor.Executor, handlers: [ )] = None, job_poll_interval=1.0, trace=False, max_job_run_time=None, max_sys_run_time=None, admin_port=33330 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:
-
class
TestController
(total_recs, max_recs_each_time) Bases:
<a href="automl.components.controllers.html#automl.components.controllers.controller.Controller">automl.components.controllers.controller.Controller</a>
-
initial_recommendation
(ctx: automl.defs.Context) → [<class ‘automl.defs.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
(outcome: automl.defs.Outcome, ctx: automl.defs.Context) → [<class ‘automl.defs.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:
<a href="automl.components.executors.html#automl.components.executors.executor.Executor">automl.components.executors.executor.Executor</a>
-
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:
<a href="automl.components.handlers.html#automl.components.handlers.handler.Handler">automl.components.handlers.handler.Handler</a>
-
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
()