-
Notifications
You must be signed in to change notification settings - Fork 165
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.
failureException = unittest.TestCase.failureException | ||
|
||
try: | ||
from GangaCore.Utility.Config import getConfig | ||
config = getConfig('TestingFramework') | ||
except BaseException: # if we are outside Ganga, use a simple dict | ||
config = {} |
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 not the right way to solve the problem of the failing tests. The code in GangaCore
should not depend on unittest
and should not mention TestingFramework
. So the required change has to be made in the failing tests instead.
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.
Understood
OK, so I think I can see two issues here with TestVirtualizationDocker.py
|
As suggested, I have moved the test to the mentioned location and also changed the import for sleep_until_completed. |
Wow, the latest round of testing shows that we have seriously managed to break something here. Quite likely it is all related to the missing |
The error in the testing is now regarding X.509 certificate expiry.
Like in this workflow we can see that the expiry is due in 8 days. Can replacing the certificate solve this issue ? |
I solved this problem and will restart the tests now. I do not think that is the full issue though. |
Yup,
This error is similar ro the one that we faced earlier. |
OK, looked at this a bit closer. We in fact do need the
|
No description provided.