Skip to content

Commit

Permalink
Make TaskVineExecutor importable when ndcctools is not available (#2909)
Browse files Browse the repository at this point in the history
Fixes issue #2903
  • Loading branch information
tphung3 authored Oct 13, 2023
1 parent 6b963ba commit dfa5e78
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
11 changes: 10 additions & 1 deletion parsl/executors/taskvine/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,22 @@
from parsl.process_loggers import wrap_with_logs
from parsl.executors.taskvine.errors import TaskVineFactoryFailure

from ndcctools.taskvine import Factory
# This try except clause prevents import errors
# when TaskVine is not used in Parsl.
try:
from ndcctools.taskvine import Factory
taskvine_available = True
except ImportError:
taskvine_available = False

logger = logging.getLogger(__name__)


@wrap_with_logs
def _taskvine_factory(should_stop, factory_config):
if not taskvine_available:
logger.debug("TaskVine package cannot be found. Please install the ndcctools package.")
return
logger.debug("Starting TaskVine factory process")

try:
Expand Down
7 changes: 6 additions & 1 deletion parsl/executors/taskvine/manager_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
from dataclasses import dataclass
from typing import Optional

from ndcctools.taskvine.cvine import VINE_DEFAULT_PORT
# This try except clause prevents import errors
# when TaskVine is not used in Parsl.
try:
from ndcctools.taskvine.cvine import VINE_DEFAULT_PORT
except ImportError:
VINE_DEFAULT_PORT = 0 # use any available port.


@dataclass
Expand Down

0 comments on commit dfa5e78

Please sign in to comment.