Hello /Scripting!
I’ve wanted to develop with Python4Capella for a long time (thank you @YvanLussaud for the great help), but when I started writing I realised there was no easy way of running scripts in a CI/CD environment. So, as a DevOps enjoyer myself, I set up a Docker image with:
Capella
Py4J
EASE
Python4Capella
also the RequirementsVP plugin as my test model uses it and others may too
…all nice and configured for easy use, with the In-Flight Entertainment sample model unpacked and all the Python4Capella sample scripts amended to run on an arbitrary target model.
Ohh! We use the Capella version of 5.2.0. That’s why we see the Error on the log with “Wrong model version detected”
Docker command
docker run -v "C:\Users\OneDrive - Applied Materials\Desktop\workspace\Python4Capella":"/workspace/user/scripts/Python4Capella" -v "C:\Users\OneDrive - Applied Materials\Desktop\workspace\In-Flight Entertainment System":"/workspace/user/models/In-Flight Entertainment System" chgio/python4capella-docker:latest "/user/scripts/Python4Capella/sample_scripts/List_logical_components_in_console.py" "/user/models/In-Flight Entertainment System/In-Flight Entertainment System.aird"
Error on the log with “Wrong model version detected”
!ENTRY org.eclipse.ease.lang.python 4 0 2024-10-24 10:43:52.641
!MESSAGE The method name "zip" from the module "__EASE_MOD_org_eclipse_ease_modules_platform_resources_ResourcesModule" can not be wrapped because it's name is reserved
!ENTRY org.eclipse.sirius.diagram 1 0 2024-10-24 10:44:27.899
!MESSAGE Migration done for "representation Change ID": all the representations changeId have been updated with the absolute time stamp (Ensure the session is saved to persist the migration effects. Please have a look at documentation about the project migration)
org.polarsys.capella.common.platform.sirius.ted.MetadataException: Wrong model version detected
Please have a look at documentation about project migration.
at org.polarsys.capella.common.platform.sirius.ted.SiriusSessionFactory$SessionMetadataHelper.checkMetadata(SiriusSessionFactory.java:167)
at org.polarsys.capella.common.platform.sirius.ted.SiriusSessionFactory.checkResource(SiriusSessionFactory.java:68)
at org.eclipse.sirius.business.internal.session.SessionFactoryImpl.loadSessionModelResource(SessionFactoryImpl.java:166)
at org.eclipse.sirius.business.internal.session.SessionFactoryImpl.createSession(SessionFactoryImpl.java:87)
at org.eclipse.sirius.business.internal.session.SessionManagerImpl.getSession(SessionManagerImpl.java:271)
at org.eclipse.python4capella.modules.SiriusModule.loadSiriusSession(SiriusModule.java:174)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
at py4j.Gateway.invoke(Gateway.java:282)
at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
at py4j.commands.CallCommand.execute(CallCommand.java:79)
at py4j.ClientServerConnection.sendCommand(ClientServerConnection.java:244)
at py4j.CallbackClient.sendCommand(CallbackClient.java:384)
at py4j.CallbackClient.sendCommand(CallbackClient.java:356)
at py4j.reflection.PythonProxyHandler.invoke(PythonProxyHandler.java:106)
at jdk.proxy3/jdk.proxy3.$Proxy4.executeScript(Unknown Source)
at org.eclipse.ease.lang.python.py4j.internal.Py4jScriptEngine.internalExecute(Py4jScriptEngine.java:248)
at org.eclipse.ease.lang.python.py4j.internal.Py4jScriptEngine.execute(Py4jScriptEngine.java:235)
at org.eclipse.ease.AbstractScriptEngine.inject(AbstractScriptEngine.java:190)
at org.eclipse.ease.AbstractScriptEngine.run(AbstractScriptEngine.java:243)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
!ENTRY org.eclipse.osgi 4 0 2024-10-24 10:44:48.440
!MESSAGE Application error
!STACK 1
java.lang.NullPointerException: Cannot invoke "org.eclipse.python4capella.commandline.Python4CapellaCommandLinePlugin$Implementation.log(Object)" because the return value of "org.eclipse.python4capella.commandline.Python4CapellaCommandLinePlugin.getPlugin()" is null
at org.eclipse.python4capella.commandline.Python4CapellaCommandLine.runScript(Python4CapellaCommandLine.java:142)
at org.eclipse.python4capella.commandline.Python4CapellaCommandLine.execute(Python4CapellaCommandLine.java:64)
at org.polarsys.capella.core.commandline.core.CommandLineApp.launchApp(CommandLineApp.java:138)
at org.polarsys.capella.core.commandline.core.CommandLineApp.start(CommandLineApp.java:72)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:402)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
at org.eclipse.equinox.launcher.Main.main(Main.java:1440)
The Capella model you are opening is not in the same version as the Capella opening it. You can try to migrate your model before using it with the docker image. Or you can try to create/use a docker image with your version of Capella.