Skip to main content

The openIMIS Backend tasks_management reference module.

Project description

openIMIS Backend tasks_management reference module

This repository holds the files of the openIMIS Backend Task Managemet reference module. It is dedicated to be deployed as a module of openimis-be_py.

ORM mapping:

  • task_management_task, task_management_historicaltask > Task
  • task_management_taskgroup, task_management_historicaltaskgroup > TaskGroup
  • task_management_taskexecutor, task_management_historicaltaskexecutor > TaskExecutor

GraphQl Queries

  • task, taskGroup, taskExecutor

Services

  • Task
    • create
    • update
    • delete
    • complete_task
    • resolve_task
  • TaskGroup
    • create
    • update
    • delete
  • TaskExecutor
    • create
    • update
    • delete
  • CheckerLogicServiceMixin
    • create
    • update
    • delete
  • on_task_complete_service_handler

Configuration options (can be changed via core.ModuleConfiguration)

  • gql_task_group_search_perms: 190001
  • gql_task_group_create_perms: 190002
  • gql_task_group_update_perms: 190003
  • gql_task_group_delete_perms: 190004
  • gql_task_search_perms: 191001
  • gql_task_create_perms: 191002
  • gql_task_update_perms: 191003
  • gql_task_delete_perms: 191004
  • default_executor_event: default

openIMIS Modules Dependencies

  • core

Creating execution action handlers and business event handlers

When user action specified by the task is being passed to backend, the task service sends task_service.resolve_task signal. The approach for handler is to bind to after signal and check the specific executor_action_event of the task. The same approach is used for business event handlers, being required to bind on task_service.complete_task.

# in signals.py in any module
def bind_service_signals():
    bind_service_signal(
        'task_service.resolve_task',
        handler_hook,
        bind_type=ServiceSignalBindType.AFTER
    )

def handler_hook(**kwargs):
    pass

Creating tasks for BaseService implementations

CheckerLogicServiceMixin allows implementations of core.services.BaseService to generate tasks for create, update and delete actions. this adds create__task methods to the service, with the same API as the methods. Additionally the on_task_complete_service_handler service method allows to generate complete_task handlers for core.services.BaseService implementations.

# In service definition
class ExampleService(BaseService, CheckerLogicServiceMixin):
    ...

# to create a task instead of performing create operation, instead of:
# ExampleService(user).create(data)
ExampleService(user).create_create_task(data)
`
#in signals.py (any module, but the same module as service preferred)
def bind_service_signals():
    bind_service_signal(
        'task_service.complete_task',
        on_task_complete_service_handler(ExampleService),
        bind_type=ServiceSignalBindType.AFTER
    )

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openimis-be-tasks_management-1.3.0.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openimis_be_tasks_management-1.3.0-py3-none-any.whl (29.5 kB view details)

Uploaded Python 3

File details

Details for the file openimis-be-tasks_management-1.3.0.tar.gz.

File metadata

File hashes

Hashes for openimis-be-tasks_management-1.3.0.tar.gz
Algorithm Hash digest
SHA256 5c9149f02df92252b010c8f8ece90f5ee32559cf9eae1be63d26b58f7b14c565
MD5 dcf28915a173b20de03b43f92483024e
BLAKE2b-256 a8261b2be7624950f27df1a5f07aed5bbf84aec74dda8bcba6499e386fd6e582

See more details on using hashes here.

File details

Details for the file openimis_be_tasks_management-1.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for openimis_be_tasks_management-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 84f5928ae92c55ccc7633df702030a5a9b5dffbdc50c68f3d454452e87a0c22a
MD5 19e14c97ef226a8338d6e0e95bc66db4
BLAKE2b-256 91573407a900d9c98cb16b3c5a83bb8aa9be7a779477ab10bdf17c4f0ab86e5b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page