Skip to content

Commit

Permalink
Merge branch 'master' of github.com:DataBiosphere/toil into issues/45…
Browse files Browse the repository at this point in the history
…54-string-to-file-wdl
  • Loading branch information
stxue1 committed Sep 6, 2023
2 parents 62b19d9 + 10a2589 commit 1c69e6e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ PyPubSub >=4.0.3, <5
addict>=2.2.1, <2.5
pytz>=2012
enlighten>=1.5.2, <2
typing-extensions
typing-extensions>=4.6.2, <5
31 changes: 15 additions & 16 deletions src/toil/cwl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import logging
import sys
from functools import lru_cache

from pkg_resources import DistributionNotFound, get_distribution
Expand All @@ -28,31 +28,30 @@ class InvalidVersion(Exception): # type: ignore

from toil.version import cwltool_version

logger = logging.getLogger(__name__)


@lru_cache(maxsize=None)
def check_cwltool_version() -> None:
"""
Check if the installed cwltool version matches Toil's expected version. A
warning is printed if the versions differ.
Check if the installed cwltool version matches Toil's expected version.
A warning is printed to standard error if the versions differ. We do not
assume that logging is set up already. Safe to call repeatedly; only one
warning will be printed.
"""
try:
installed_version = get_distribution("cwltool").version

if installed_version != cwltool_version:
logger.warning(
f"You are using cwltool version {installed_version}, which might not be compatible with "
f"version {cwltool_version} used by Toil. You should consider running 'pip install cwltool=="
f"{cwltool_version}' to match Toil's cwltool version."
sys.stderr.write(
f"WARNING: You are using cwltool version {installed_version}, which is "
f"not the version Toil is tested against. To install the correct cwltool "
f"for Toil, do:\n\n\tpip install cwltool=={cwltool_version}\n\n"
)
except DistributionNotFound:
logger.debug("cwltool is not installed.")
# cwltool is not installed
pass
except InvalidVersion as e:
logger.warning(
f"Could not determine the installed version of cwltool because a package "
f"with an unacceptable version is installed: {e}"
sys.stderr.write(
f"WARNING: Could not determine the installed version of cwltool because a package "
f"with an unacceptable version is installed: {e}\n"
)


check_cwltool_version()
2 changes: 2 additions & 0 deletions src/toil/cwl/cwltoil.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@

from toil.batchSystems.registry import DEFAULT_BATCH_SYSTEM
from toil.common import Config, Toil, addOptions
from toil.cwl import check_cwltool_version
check_cwltool_version()
from toil.cwl.utils import (
CWL_UNSUPPORTED_REQUIREMENT_EXCEPTION,
CWL_UNSUPPORTED_REQUIREMENT_EXIT_CODE,
Expand Down
4 changes: 2 additions & 2 deletions src/toil/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ def workerScript(jobStore: AbstractJobStore, config: Config, jobName: str, jobSt

if redirectOutputToLogFile:
# Announce that we are redirecting logging, and where it will now go.
# This is important if we are trying to manually trace a faulty worker invocation.
logger.info("Redirecting logging to %s", tempWorkerLogPath)
# This is only important if we are trying to manually trace a faulty worker invocation.
logger.debug("Redirecting logging to %s", tempWorkerLogPath)
sys.stdout.flush()
sys.stderr.flush()

Expand Down

0 comments on commit 1c69e6e

Please sign in to comment.