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
Release files for eoq3pyactions 3.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| eoq3pyactions-3.1.0.tar.gz | 19.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| eoq3pyactions-3.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.5 kB
Release files / eoq3pyactions-3.1.0.tar.gz
| Download URL | eoq3pyactions-3.1.0.tar.gz |
|---|---|
| Size | 19.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
82644bce05e2b01a63daae0e884828e60233d1a6392aee694fa98a319aea0b20
|
|
BLAKE2b-256 checksum How to use checksums |
2e610414e9f84f0680945b8b0edaec92ffcdfba28794b3a9529b508249ee1540
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / eoq3pyactions-3.1.0-py3-none-any.whl
| Download URL | eoq3pyactions-3.1.0-py3-none-any.whl |
|---|---|
| Size | 21.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
efa3df77f1c84ee16a082ca1eba335ed06310684a6eb4edad6c83cc5d3549b30
|
|
BLAKE2b-256 checksum How to use checksums |
52438205903e05e8f635fcf652ff80582f6cf3e4efd4dd35265622ef445bcbfa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|