-
Notifications
You must be signed in to change notification settings - Fork 163
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
Migrate Utility functions to core #2406
base: develop
Are you sure you want to change the base?
Conversation
@Ishaan-Chandak I just created a PR from your branch as it makes it easier to comment on the code. |
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.
Try to implement the changes suggested here. If that then removes the warnings, then the entire code base should be changed to use the new import location.
It would be good to write test cases for all the different utility functions as well. If you decide to do this, the tests should utilise the mock system to avoid actually submitting and running any jobs as part of the tests.
Another comment is that we should make sure that the old import location still works but emits a deprecation warning. While the code is not formally part of the Ganga API, it will have a number of external users. |
ganga/ganga/__init__.py
Outdated
@@ -10,6 +10,7 @@ | |||
import GangaCore.Core | |||
from GangaCore.Core.GangaRepository import getRegistry | |||
from GangaCore.Core.InternalServices.ShutdownManager import _protected_ganga_exitfuncs | |||
from ganga.GangaCore.Utility.Config.Config import ConfigError |
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 ConfigError
ever used? If not, we can delete this line.
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.
no it was not being used,
I have deleted this
OK, so I guess the final thing that is required is to change all the imports in the testing code. I give a list below. I think a global search and replace with the new location should work.
|
ganga/GangaTest/Framework/utils.py
Outdated
warnings.warn( | ||
"The module 'ganga.GangaTest.Framework.util' is deprecated and will be removed in a future release. " | ||
"Please use 'ganga.GangaCore.Utility.job_monitoring' instead.", | ||
DeprecationWarning, | ||
stacklevel=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.
Did you check that this is actually working
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.
Yes, I did test this. I tested the read_file functionality. I created a python script and a dummy read file and checked by importing the read_file function from GangaTest.framework.utils.
It did work correctly.
No description provided.