-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support enabling IPM instance-wide #485
Conversation
Even %SYS, but not using the %ALL namespace because that ends up overriding namespace-specific mappings (gah).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@isc-tleavitt a few comments but looks good!
This always struck me as an unfortunate design choice. Too late to get it changed now, but maybe a second pseudo-namespace %DEFAULT could be added whose mappings defer to namespace specific ones. |
@gjsjohnmurray thanks for chiming in! I like the idea and will float it, but we won't be able to make it a prerequisite for this work. |
Not sure why the CIs are failing. Tried to run the tests locally on 9b19985 it still fails although CIs passed in May ... |
It appears the CI failure stems from this block ipm/src/cls/IPM/Lifecycle/Base.cls Line 1069 in bf8ed87
|
Next steps here for @isc-shuliu who's carrying this work forward:
|
CIs are failing specifically in I4H because migration was not successful (see log line 1362). This failure was introduced by changes in bf6e699 which attempts to perform data migration in all namespaces Guess I shouldn't perform it in all namespaces according to this comment ipm/src/cls/IPM/Utils/Migration.cls Line 29 in 6a9dd01
@isc-tleavitt Any insights? |
This PR should now meet the requirement in #470 (comment) . Specifically,
This can be done by mapping the current IPM globally
This is achieved by checking whether IPM in current NS is mapped if a user attempts to install/reinstall/uninstall IPM. If IPM is mapped from elsewhere, will abort and prompt the user to go the source namespace.
This is achieved by adding the
The
If IPM is not installed, will iterate through all namespaces and run
%IPM.Utils.Migration:MigrateZPMToIPM() will be called in each namespace |
The issue here is:
Two classes of issues here:
Ultimately, I think the issue is going to be that we should only try to migrate a namespace's data after it's mapped. Data migration post-installation should migrate everywhere that is already mapped (mostly will be useful for future automatic data migrations); mapping should migrate the newly-mapped namespace. The automatic mapping post-installation on an environment with older ZPM will end up migrating each namespace as it's mapped. That covers all scenarios. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See also #485 (comment) - soooo close.
@isc-tleavitt I updated the migration logic to run only in namespaces where %IPM is mapped from the current namespace. This resolved the problem for HSLIB but still doesn't successfully migrate HSCUSTOM, HSSYS, and HSSYSLOCALTEMP. In I4H, HSCUSTOM, HSSYS, and HSSYSLOCALTEMP did not have %IPM mapping initially. Upgrading from %ZPM to %IPM automatically adds %IPM mapping for them. However, data migration still fails in these 3 namespaces. |
@isc-tleavitt I think I figured out why: In ##class(%IPM.Utils.Migration).MigrateOneRepo(), we should check for Set newObj = ##class(%IPM.Repo.Definition).%OpenId(newId,,.sc) instead of Set newObj = ##class(%IPM.Storage.Module).%OpenId(newId,,.sc) This is likely an error due to copy-paste from |
@isc-shuliu goooood catch! Thank you! |
I can't approve this (since it was originally my PR), but I think it's in a good state; would appreciate an eye on this from @isc-kiyer next week. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@isc-shuliu a few comments. Can maybe skip the one about changing the structure of the subscripted array to JSON since that would be more invasive (just the current structure is quite hard to follow).
preload/cls/IPM/Installer.cls
Outdated
@@ -35,6 +35,7 @@ XData PM [ XMLNamespace = INSTALLER ] | |||
<Arg Value="${MODDIR}"/> | |||
</Invoke> | |||
<Invoke Class="IPM.Installer" Method="ZPMCompile" CheckStatus="true" /> | |||
<Invoke Class="IPM.Installer" Method="MapIfLegacy" CheckStatus="true" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General question: how do you decide what should go into this installer block vs in the module.xml? Should each invoke here be there too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is that <Invoke>
s in module.xml should be a (not necessarily proper) subset of Installer.cls since a legacy user can always download a release artifact from GitHub or community PM registry.
Not sure if there are <Invoke>
s that we only want present in Installer.cls but not module.xml.
@isc-tleavitt Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, things only need to go into module.xml and the installer will run them. The issue here is in setting up mappings in advance of load when someone is already running legacy %ZPM and upgrades by loading/running an installer; that's why this particular thing needs to be here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait - I'm wrong, we shouldn't need this because the above (line 34) call to ZPMLoad will end up running all the <Invoke>
s.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was confusing this with:
<Invoke Class="IPM.Installer" Method="Map" Phase="Reload" When="Before" />
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@isc-shuliu @isc-tleavitt so should the installer invokes be removed in favor of the Invoke's in module.xml? The installer then essentially installs the module using itself which would run invokes from the module.xml?
Quit $$$OK | ||
} | ||
|
||
If tModuleName = $$$IPMModuleName { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this check should be moved to LoadNewModule instead to catch the case from the load command as well instead of just the install command. Before loading the file using $System.OBJ.Load(), can read the module name using xslts to confirm whether it can be loaded in the current namespace.
src/cls/IPM/Main.cls
Outdated
// but need to decide what level of customization to provide | ||
Quit "" | ||
// TODO: Needs to support enabling IPM from here, also need to decide what level of customization to provide | ||
Set tQuitOnError = $Get(pArgs(2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this quit/halt on error stuff a general feature of ZLANG or something specific here? Could you add some more doc about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is specific to the zpm command - should be covered in doc for %IPM.Main:Shell.
This is done via new options in the existing zpm "enable" command that add package mappings.
We looked into using %ALL but ultimately that doesn't work, because namespace-specific mappings aren't allowed to override %ALL mappings (!?).
Fixes #470