-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This gave measurable performance improvement under very high load/shared fs situations, but it is a lot of additional complexity in the code to achieve that. Reducing import cost is probably a good goal, but this way is probably not the way to do it.
- Loading branch information
1 parent
526ab75
commit e5603a7
Showing
10 changed files
with
82 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,4 @@ | ||
from typing import TYPE_CHECKING | ||
|
||
if TYPE_CHECKING: | ||
from parsl.channels.base import Channel | ||
from parsl.channels.local.local import LocalChannel | ||
|
||
lazys = { | ||
'Channel': 'parsl.channels.base', | ||
'LocalChannel': 'parsl.channels.local.local', | ||
} | ||
|
||
import parsl.channels as px | ||
|
||
|
||
def lazy_loader(name): | ||
if name in lazys: | ||
import importlib | ||
m = lazys[name] | ||
# print(f"lazy load {name} from module {m}") | ||
v = importlib.import_module(m) | ||
# print(f"imported module: {v}") | ||
a = v.__getattribute__(name) | ||
px.__setattr__(name, a) | ||
return a | ||
raise AttributeError(f"No (lazy loadable) attribute in {__name__} for {name}") | ||
|
||
|
||
px.__getattr__ = lazy_loader # type: ignore[method-assign] | ||
from parsl.channels.base import Channel | ||
from parsl.channels.local.local import LocalChannel | ||
|
||
__all__ = ['Channel', 'LocalChannel'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.