-
Notifications
You must be signed in to change notification settings - Fork 4
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
Module Dependency Errors #1325
Comments
I think this is a good idea @mnjowe |
Agreed - this would be a nice feature to add. I think how the module dependencies are already declared could already allow doing this on the presumption that there is only one subclass of TLOmodel/src/tlo/dependencies.py Lines 175 to 199 in 581ebe4
allows constructing a map from module name strings to module classes. I think we would probably want to make this behaviour opt-in, at least initially, rather than the default so we could so somehting like add a keyword argument |
Thanks so much @matt-graham for the detailed explanation on how we can go about this. Should I then in a few days open a new PR on this? |
Yeah opening a PR on this would be great! I would potentially try to deal with the issue of setting To avoiding delaying a PR on adding the automatic module registering, for now we could potentially assume something like that automatically loaded dependencies are initialised with the |
Great, thanks @matt-graham . The two issues you have noted above are indeed so important in as far resolving this automatic module registering issue is concerned. Especially the resource file path which is needed when registering disease modules. I think I will have to delay my PR on this until you have found a workaround on the resource file issue. Thanks |
Thanks @matt-graham and @mnjowe You're both quite right about the 'resourcefilepath' thing. I do think that we can assume that the Indeed, I think there is already a structure for this, that we should have been using all along (I think I am to blame for not using it!): The place where the data is read-in is always |
****** For such moments where you don't want to run a full model analyses **************
@tbhallett , @tamuri and @matt-graham
With modules declaring dependencies and analyses wanting the modules where these dependencies are declared registered in
sim.register()
, I think it is somewhat difficult for someone new to TLM to setup a small analyses and run it as it will keep crashing with module dependency errors. see below for an exampletlo.dependencies.ModuleDependencyError: Module Tb depends on Epi which is missing from modules to register as are any alternatives to Epi.
Wouldn't it be nice if we can automatically register modules that are missing in simulation? i.e. when disease modules are declaring module dependencies they also declare/include the module name where this dependency is found. something like
INIT_DEPENDENCIES = {'enhanced_lifestyle': 'Lifestyle'}
. That way we could use the module name to automatically register the module if not already registered insim.register()
?I know there might be some better ways to doing it BUT I just feel it would simplify the process of setting up a smaller analyses if all missing modules could be automatically registered instead of crashing the simulation.
The text was updated successfully, but these errors were encountered: