Skip to content
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

Csse layout input_data #459

Merged
merged 13 commits into from
Nov 28, 2024
Merged

Csse layout input_data #459

merged 13 commits into from
Nov 28, 2024

Conversation

loriab
Copy link
Collaborator

@loriab loriab commented Nov 13, 2024

Description

currently atop #458

Changelog description

  • implement AtomicResult.input_data = AtomicInput in all the harnesses and adjust some output checks as needed. Check extras is getting separated btwn in/out as formerly merged.

Status

  • Code base linted
  • Ready to go

Copy link

codecov bot commented Nov 13, 2024

Codecov Report

Attention: Patch coverage is 96.22642% with 6 lines in your changes missing coverage. Please review.

Project coverage is 81.94%. Comparing base (0642655) to head (d22eb37).
Report is 8 commits behind head on next2024.

Additional details and impacted files

@loriab loriab marked this pull request as ready for review November 26, 2024 20:55
@loriab
Copy link
Collaborator Author

loriab commented Nov 26, 2024

Requesting review @davidbrownell, @krachwal, @rfievet, @ketanbj, @varun646, @jyoung3131

@@ -41,7 +41,10 @@ def test_psi4_task(schema_versions, request):
ret = qcng.compute(input_data, "psi4", raise_error=True, return_version=retver)
ret = checkver_and_convert(ret, request.node.name, "post")

assert ret.driver == "energy"
if "v2" in request.node.name:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have enough context to know if the following comment is helpful or falls into the category of over-architecture...

It seems that there is a repeating pattern at play of "if the request is v2, access a value in this way; if the request is v1, access a value in that way.". Perhaps there is a design that can group the v2 ways of accessing data and the v1 ways of accessing data. It might look something like...

from ABC import ABC, abstractmethod

class RequestAccessor(ABC):
    @staticmethod
    def GetAccessor(request):
        if "v2" in request.node.name:
            return V2RequestAccessor(request)
        
        return V1RequestAccessor(request)
        
    def __init__(self, request):
        self.request = request

    @abstractmethod
    def RequestDriver(self):
       raise NotImplementedError("Abstract method")

class V1RequestAccessor(RequestAccessor):
    def GetDriver(self):
        return self.request.driver

class V2RequestAccessor(RequestAccessor):
    def GetDriver(self):
        return self.request.input_data.driver

I'm wondering if this class might be valuable to people going through the v1 to v2 migration.

There may even be a simpler way to do this if the difference is always that v2 has input_data while v1 does not.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, but I think explicit is better than accessor in this case. I'm expecting that users going through the v1 to v2 migration who don't want to confront changes at first will take their existing input or output and run .convert_v(1|2) on it. Your route would let them deal with one field at a time, but locations may vary depending on what order one migrates the fields, so that's getting complicated. The clutter in the tests could be done away with by adding convert_v calls to the checkver_and_convert that are already set up in all the tests (in fact, that's what my work items were planning on before I decided on explicit logic). But since the tests are the most abundant source of model schema for users, I thought explicit might be better. It doesn't help the user, but typing the logic for me isn't as much of a burden as it looks (see next PR in series) since CoPilot suggests with excellent accuracy.

@loriab loriab merged commit 996e88f into MolSSI:next2024 Nov 28, 2024
15 checks passed
@loriab loriab deleted the csse_layout_537b branch December 2, 2024 14:41
loriab added a commit that referenced this pull request Jan 18, 2025
* nwchem working

* openmm

* xtb

* s-dftd3 and gcp input_data

* terachem

* qchem mp2d molpro

* failure_engine and mace

* cfour and torchani

* input_data: adcc, aimnet2, mopac, rdkit, psi4

* input_data mrchem gamess

* missed one

* fix data_layout turbomole

* fix basis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants