karbor.services.operationengine.engine.executors package

Submodules

karbor.services.operationengine.engine.executors.base module

Executor which receives operations and run them.

class karbor.services.operationengine.engine.executors.base.BaseExecutor(operation_manager)

Bases: object

abstract cancel_operation(operation_id)

Cancel the execution of operation.

There is no effective for the operations which are running, but for operations which are in waiting, they will not be executed.

Parameters

operation_id – ID of operation

abstract execute_operation(operation_id, triggered_time, expect_start_time, window_time, **kwargs)

Execute an operation.

Parameters
  • operation_id – ID of operation

  • triggered_time – time when the operation is triggered

  • expect_start_time – expect time when to run the operation

  • window_time – time how long to wait to run the operation after expect_start_time

abstract resume_operation(operation_id, **kwargs)

Resume operations.

Get operations which are not finished from DB by operation_id, and execute them again.

Parameters

operation_id – ID of operation

abstract shutdown()

Shutdown the executor

karbor.services.operationengine.engine.executors.green_thread_executor module

class karbor.services.operationengine.engine.executors.green_thread_executor.GreenThreadExecutor(operation_manager)

Bases: karbor.services.operationengine.engine.executors.base.BaseExecutor

cancel_operation(operation_id)

Cancel the execution of operation.

There is no effective for the operations which are running, but for operations which are in waiting, they will not be executed.

Parameters

operation_id – ID of operation

execute_operation(operation_id, triggered_time, expect_start_time, window_time, **kwargs)

Execute an operation.

Parameters
  • operation_id – ID of operation

  • triggered_time – time when the operation is triggered

  • expect_start_time – expect time when to run the operation

  • window_time – time how long to wait to run the operation after expect_start_time

resume_operation(operation_id, **kwargs)

Resume operations.

Get operations which are not finished from DB by operation_id, and execute them again.

Parameters

operation_id – ID of operation

shutdown()

Shutdown the executor

karbor.services.operationengine.engine.executors.scheduled_operation_executor module

class karbor.services.operationengine.engine.executors.scheduled_operation_executor.ScheduledOperationExecutor(operation_manager)

Bases: karbor.services.operationengine.engine.executors.base.BaseExecutor

execute_operation(operation_id, triggered_time, expect_start_time, window_time, **kwargs)

Execute an operation.

Parameters
  • operation_id – ID of operation

  • triggered_time – time when the operation is triggered

  • expect_start_time – expect time when to run the operation

  • window_time – time how long to wait to run the operation after expect_start_time

resume_operation(operation_id, **kwargs)

Resume operations.

Get operations which are not finished from DB by operation_id, and execute them again.

Parameters

operation_id – ID of operation

karbor.services.operationengine.engine.executors.thread_pool_executor module

class karbor.services.operationengine.engine.executors.thread_pool_executor.ThreadPoolExecutor(operation_manager, thread_count=None)

Bases: karbor.services.operationengine.engine.executors.scheduled_operation_executor.ScheduledOperationExecutor

cancel_operation(operation_id)

Cancel the execution of operation.

There is no effective for the operations which are running, but for operations which are in waiting, they will not be executed.

Parameters

operation_id – ID of operation

shutdown(wait=True)

Shutdown the executor

Module contents