Skip to content

Commit e4c2178

Browse files
authored
Remove requirement that executors implement their own .start() (#3987)
This is most immediately driven by my work to upgrade to mypy 1.18.2 from mypy 1.5.1. In that change, mypy now raises an error if a class calls the abstract-decorated superclass method: ``` parsl/executors/globus_compute.py:81: error: Call to abstract method "start" of "ParslExecutor" with trivial body via super() is unsafe [safe-super] ``` This happens elsewhere in the codebase too, but mypy doesn't notice those occurences. As demonstrated by the GlobusComputeExecutor, it isn't actually mandatory for executor-specific start behaviour to exist. So, this PR removes the @AbstractMethod decorator from the executor.start() method. It is no longer mandatory to implement; the existing no-op default implementation remains but no longer upsets more recent mypy. The .start method remains as an optional hook which most executors still choose to use. This PR also removes the stub in GlobusComputeExecutor which was there only to satisfy the now-removed @AbstractMethod requirement. # Changed Behaviour Shouldn't change user experience. Developers of new executors will no longer be forced to implement start and will have to discover it (if they want it) by reading. ## Type of change - Code maintenance/cleanup
1 parent 5800a80 commit e4c2178

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

parsl/executors/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> Literal[False]:
8080
self.shutdown()
8181
return False
8282

83-
@abstractmethod
8483
def start(self) -> None:
8584
"""Start the executor.
8685
87-
Any spin-up operations (for example: starting thread pools) should be performed here.
86+
By default, this does nothing, but this method should be overridden to
87+
perform any spin-up operations (for example: starting thread pools).
8888
"""
8989
pass
9090

parsl/executors/globus_compute.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,6 @@ def __init__(
7676
self.storage_access = storage_access
7777
self.working_dir = working_dir
7878

79-
def start(self) -> None:
80-
""" Start the Globus Compute Executor """
81-
super().start()
82-
8379
def submit(self, func: Callable, resource_specification: Dict[str, Any], *args: Any, **kwargs: Any) -> Future:
8480
""" Submit func to globus-compute
8581

0 commit comments

Comments
 (0)