Skip to main content

action handler and python actions for EOQ3

Project description

eoq3pyecoremdb - action handler and python actions for EOQ3

Actions are scripts to be applied on elements of a domain. The application is triggered throug the domain and script execution can be remote. Actions might be parameterized to configure their targets and/or execution.

This comprises action handler and action manager. Per domain one action manager and several action handlers can be instantiated.

  • action manager: extends the domain by an action model as well as commands to call and abort actions.
  • action handler: registers local python scripts as actions in the actions manager and listens to execution requests.

Usage

API

Imports:

from eoq3pyactions.actionhandler import ActionHandler
from eoq3pyactions.actionmanager import ActionManager
from eoq3pyactions.util import *

Create and connect an action manager:

amaSessionId = GenerateSessionId() #action manager
domain.Do(Hel('actionmanager','xxx'),amaSessionId)
ama = ActionManager(config)
ama.Connect(domain, amaSessionId)

Create and connect an action handler:

ahaSessionId = GenerateSessionId() #action handler
domain.Do(Hel('actionhandler','xxx'),ahaSessionId) 
aha = ActionHandler(basedir=ACTIONS_DIR)
aha.Connect(domain,ahaSessionId)

Call an action and retrieve the results (for the action itself, see example action below):

res = domain.Do( Cus('CAL',['Misc/helloworld',[1]]) ,asDict=True)
job = res['job']
#wait for action to finish
sleep(1.0) #make sure action has finished
#check result 
res = domain.Do( Get( Qry(job).Pth('results*').Idx(0) ) )
# res should be STR("I printed 1 times Hello world!")

Alternative ways to call actions:

#action call by util funciton and wait seperate
res = CallAction(domain,sessionId,'helloworld',[1])
job = res['job']
jobStatus = res['statusInstance']
WaitForAction(domain,sessionId,job,jobStatus,10.0)
#call and wait with one helper
CallActionAndWait(domain,sessionId,'helloworld',[],10.0)

See also Test/Eoq3/test_eoq3pyactions.py.

Example action

This must reside as in ACTIONS_DIR:

__tags__ = ['misc','test'] #classification tags to be used in clients #tags are optional

def helloworld(domain : 'Domain', times : 'I64=2')->'STR':
    t = times.GetVal()
    for i in range(t):
        print("Hello world!",end='')
    return "I printed %d times Hello world!"%(t)

Implementation

Large parts of the wrapper between pyecore an EOQ3 are generated from the concepts generation. To regenerate use:

gen/generatepyecoremdb.py

Documentation

For more information see EOQ3 documentation: https://eoq.gitlab.io/doc/eoq3/

Author

2024 Bjoern Annighoefer

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

eoq3pyactions-2.9.0.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

eoq3pyactions-2.9.0-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file eoq3pyactions-2.9.0.tar.gz.

File metadata

  • Download URL: eoq3pyactions-2.9.0.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for eoq3pyactions-2.9.0.tar.gz
Algorithm Hash digest
SHA256 1f97cee1644459c47500ae56a7796e0f6fae83c4184a05167079bc1f74d32e06
MD5 31c3262bfcb3921e3b096b363144414c
BLAKE2b-256 ad6380f220e647c6c7803787a0266f26e49d882d5d4676f05b15effdd2e6dd7f

See more details on using hashes here.

File details

Details for the file eoq3pyactions-2.9.0-py3-none-any.whl.

File metadata

File hashes

Hashes for eoq3pyactions-2.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d16be07ec6c17392a6a0c288658ed9660ff565e18655685d15bc1322a00fb715
MD5 887e9e508e604d4a5d7da4fe8a0f4020
BLAKE2b-256 917c4e9fdaf19b4832f5eea686debbb4b598679be7f33dd14e1953d511078ce3

See more details on using hashes here.

Supported by

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