Openff-toolkit: What to do when two installed offxml files have the same relative path from their respective entry points?

Created on 17 May 2019  路  1Comment  路  Source: openforcefield/openff-toolkit

See the discussion here: https://github.com/openforcefield/openforcefield/pull/322#discussion_r285204727

j-wags 39 minutes ago Member

In the case that there are two files that match a given query, can we make any statement about which one will be returned? Maybe something like guaranteeing the order of entry point registration? Or can we blame any ambiguity there on user error?

j-wags 32 minutes ago Member

This was an issue before this PR, but it could be exacerbated by allowing FFs from external sources. I've added a TODO to keep a record of this concern.

andrrizzi 29 minutes ago Author Member

I'm not sure we can control it because, if it's not random, it probably depend on the order the forcefield packages will be installed. I can change the code to raise a warning or an error with a flag to load the first one to make this case a little safer.

j-wags 25 minutes ago Member

This is probably a complicated question, and worthy of further discussion. Like, if multiple FFs with the same name are found, but they have identical contents, maybe that's permissible? This will require some thinking about how the FF community/ecosystem will evolve. Let's open an issue to discuss, but not hold these changes up in the meantime.

error handling question

Most helpful comment

If this happens, we should raise an exception and list all installed versions that match that path, like

Exception: Multiple packages have installed force field files at the specified path 'path/to/forcefield.offxml`:
* packagename1 : path/to/forcefield.offxml
* packagename2 : path/to/forcefield.offxml
To specify a unique choice, qualify the path name with `packagename:path/to/forcefield.offxml` or uninstall one of the conflicting packages.

However, there is one case we can handle without concern: If the files are identical (their MD5 hashes are identical), then we can safely proceed without an exception.

>All comments

If this happens, we should raise an exception and list all installed versions that match that path, like

Exception: Multiple packages have installed force field files at the specified path 'path/to/forcefield.offxml`:
* packagename1 : path/to/forcefield.offxml
* packagename2 : path/to/forcefield.offxml
To specify a unique choice, qualify the path name with `packagename:path/to/forcefield.offxml` or uninstall one of the conflicting packages.

However, there is one case we can handle without concern: If the files are identical (their MD5 hashes are identical), then we can safely proceed without an exception.

Was this page helpful?
0 / 5 - 0 ratings