-
Notifications
You must be signed in to change notification settings - Fork 8
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
Adding and updating __init__ files for modules #14
Conversation
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.
Missing initialization
imports (QuantityFactory is a big one)
Please merge in |
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.
I'd like to see typing exposed at a higher level, and a couple of questions about the layout otherwise.
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.
Good job so far.
I am still debating internally if I dont' want to see two tier of exposure. One first tier of features we almost always need e.g. (Comm, Orchestration, Halo, etc.) and a second tier of more uncommon feature e.g. (CompareToNumpyStencil, Snapshot, ZarrMonitor, etc.)
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.
My main request is that I don't love taking so much out of the init files, and would prefer we kept more in them. If that causes problems with circular imports I'd rather we prioritize the NDSL interface over removing relative imports internally, though I believe there should be other workarounds
ndsl/__init__.py
Outdated
TilePartitioner, | ||
) | ||
from .dsl import ( | ||
CompareToNumpyStencil, |
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.
Not sure if we need this at the top level
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 advanced system but for now it's the only one, so I'd leave it here
ndsl/performance/__init__.py
Outdated
@@ -1,2 +1,2 @@ | |||
from .config import PerformanceConfig |
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.
I would also leave this in as well
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.
Poke
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.
Just leave in PerformanceConfig
or/and NullTimer
, Timer
?
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.
I'd say the tree are useful here either for us or typing
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.
Left all three in.
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.
Getting there! I think there's more that can be moved down the chain, but my main quibble is with defining abstract base classes in ndsl.typing instead of keeping them where they were and importing them into ndsl.typing for exposure
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.
I think the idea here is not so much that typing would define a Communicator or Checkpointer base class but that they would be imported into typing so that they would be exposed here when you import ndsl.typing
ndsl/comm/partitioner.py
Outdated
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.
the Partitioner abc should still live here IMO
ndsl/grid/__init__.py
Outdated
xyz_to_lon_lat, | ||
) | ||
from .eta import HybridPressureCoefficients | ||
from .generation import GridDefinition, GridDefinitions, MetricTerms |
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.
GridDefinition doesn't need to be exposed IMO
ndsl/stencils/__init__.py
Outdated
from .testing.grid import Grid # type: ignore | ||
from .testing.parallel_translate import ( | ||
ParallelTranslate, | ||
ParallelTranslate2Py, | ||
ParallelTranslate2PyState, | ||
ParallelTranslateBaseSlicing, | ||
ParallelTranslateGrid, | ||
) | ||
from .testing.savepoint import SavepointCase, Translate, dataset_to_dict | ||
from .testing.temporaries import assert_same_temporaries, copy_temporaries | ||
from .testing.translate import ( | ||
TranslateFortranData2Py, | ||
TranslateGrid, | ||
pad_field_in_j, | ||
read_serialized_data, | ||
) |
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.
I think the testing stuff could still be in stencils.testing but that's not a big deal either way
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.
Move down to testing
it's specific enough
Yes E.g.
any calling code can then do
It is more correct and also would allow us to swap implementation below without touching the exposure |
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.
We are getting there. This raises a ton of good question on the architecture of this monster. Very necessary work
ndsl/checkpointer/__init__.py
Outdated
from .null import NullCheckpointer | ||
from .snapshots import SnapshotCheckpointer | ||
from .snapshots import SnapshotCheckpointer, _Snapshots |
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.
Do we need _Snapshots
? We should always try to have _X
class or functions hidden, as this what the prefixed _
is suppose to hint at
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.
A few notes to addressed that I poked
ndsl/__init__.py
Outdated
from .types import Allocator, AsyncRequest, NumpyModule | ||
from .units import UnitsError |
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.
Poke
@@ -1,3 +1,2 @@ | |||
from .netcdf_monitor import NetCDFMonitor | |||
from .protocol import Monitor |
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.
Poke
ndsl/performance/__init__.py
Outdated
@@ -1,2 +1,2 @@ | |||
from .config import PerformanceConfig |
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.
Poke
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.
LGTM
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.
1 minor requests that isn't blocking. Nice job
@@ -1,3 +1,2 @@ | |||
from .netcdf_monitor import NetCDFMonitor | |||
from .protocol import Monitor |
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.
Some day ZarrMonitor should be as well, once zarr is more prevalent (fingers crossed)
ndsl/typing.py
Outdated
from ndsl.comm.local_comm import AsyncResult, ConcurrencyError | ||
from ndsl.comm.null_comm import NullAsyncResult | ||
from ndsl.comm.partitioner import Partitioner | ||
from ndsl.performance.collector import AbstractPerformanceCollector | ||
from ndsl.types import AsyncRequest, NumpyModule | ||
from ndsl.units import UnitsError |
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.
UnitsError and ConcurrencyError don't really belong there, but we could import them into ndsl.exceptions.py
I don't believe AsyncResult and NullAsyncResult belong here either, to be honest.
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.
Will remove and push again
…sult and NullAsyncResult out of typing
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.
Good job.
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.
Great, thanks!
Description
Adding init files to standardize import method of modules
How Has This Been Tested?
Tested via lint and currently implemented translate tests
OS: RHEL 8.9 Ootpa
Built conda environment using workflow in github action configurations
Checklist: