Open daimor opened 1 year ago
workaround to load zpm libs :
credit to @daimor : https://github.com/intersystems-community/zpm-dockerhub/blob/master/iris_ipm.py
def ipm(cmd, *args):
"""
Executes shell command with IPM:
Parameters
----------
cmd : str
The command to execute
Examples
--------
`ipm('help')`
`ipm('load /home/irisowner/dev -v')`
`ipm('install webterminal')`
"""
import multiprocessing
def shell(cmd, status):
import iris
status.put(True)
res = iris.cls("%ZPM.PackageManager").Shell(cmd)
print('')
if res != 1:
status.get()
status.put(False)
manager = multiprocessing.Manager()
status = manager.Queue()
process = multiprocessing.Process(
target=shell,
args=(
cmd,
status,
),
)
process.start()
process.join()
return status.get()
can't be reproduce on :
'IRIS for UNIX (Ubuntu Server LTS for x86-64 Containers) 2023.1 (Build 229U) Fri Apr 14 2023 17:37:52 EDT'
iris @ https://github.com/grongierisc/iris-embedded-python-wrapper/releases/download/v0.0.4/iris-0.0.4-py3-none-any.whl
Interpreter :
python3 or irispython / Python 3.10.12
Result :
>>> iris.cls("%ZPM.PackageManager").Shell("load /irisdev/app/test -v")
Load started on 09/08/2023 14:02:25
Loading file /irisdev/app/test/module.xml as xml
Imported document: demo.ZPM
Load finished successfully.
Skipping preload - directory does not exist.
Load started on 09/08/2023 14:02:25
Loading file /irisdev/app/test/module.xml as xml
Imported document: demo.ZPM
Load finished successfully.
Loading demo in process 3782
[IRISAPP|demo] Reload START (/irisdev/app/test/)
Skipping preload - directory does not exist.
Load of directory started on 09/08/2023 14:02:25
Loading file /irisdev/app/test/tests/test.cls as cls
Imported class: test.tests.test
Load finished successfully.
[IRISAPP|demo] Reload SUCCESS
[demo] Module object refreshed.
[IRISAPP|demo] Validate START
[IRISAPP|demo] Validate SUCCESS
[IRISAPP|demo] Compile START
[IRISAPP|demo] Compile SUCCESS
[IRISAPP|demo] Activate START
[IRISAPP|demo] Configure START
[IRISAPP|demo] Configure SUCCESS
Studio project created/updated: demo.PRJ
[IRISAPP|demo] Activate SUCCESS1
@alexatwoodhead can you try reproduce it on windows ?
I can get the command iris.cls("%ZPM.PackageManager").Shell("load [ windows dir with module ]") to run directly, successfully. The "def ipm" had issues on my local windows, but maybe this file is only required within the docker appliance ( Ubuntu ).
When using IPM
Empty IPM Module, like below, with nothing at all
And python code, which installs it
Crashes, right after the execution in %ZPM, with exit code 3, will not print done