Skip to content

Commit 3a08510

Browse files
committed
Add better logs for pydra package import handling
1 parent 67ee789 commit 3a08510

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

physutils/tasks.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@
1414

1515
pydra_imported = True
1616
except ImportError:
17-
logger.warning(
18-
"Pydra is not installed, so the physutils tasks are not available as pydra tasks"
19-
)
20-
LGR.warning(
21-
"Pydra is not installed, so the physutils tasks are not available as pydra tasks"
22-
)
2317
pydra_imported = False
2418

2519

@@ -29,20 +23,11 @@ def decorator(func):
2923
# If the decorator exists, apply it
3024
@wraps(func)
3125
def wrapped_func(*args, **kwargs):
26+
logger.debug(f"Creating pydra task for {func.__name__}")
3227
return pydra.mark.task(func)(*args, **kwargs)
3328

3429
return wrapped_func
3530
# Otherwise, return the original function
36-
logger.warning(
37-
"Pydra is not installed, so {} is not available as a pydra task".format(
38-
func.__name__
39-
)
40-
)
41-
LGR.warning(
42-
"Pydra is not installed, so {} is not available as a pydra task".format(
43-
func.__name__
44-
)
45-
)
4631
return func
4732

4833
return decorator
@@ -52,6 +37,10 @@ def wrapped_func(*args, **kwargs):
5237
def transform_to_physio(
5338
input_file: str, mode="physio", fs=None, bids_parameters=dict(), bids_channel=None
5439
) -> Physio:
40+
if not pydra_imported:
41+
LGR.warning(
42+
"Pydra is not installed, thus transform_to_physio is not available as a pydra task. Using the function directly"
43+
)
5544
LGR.debug(f"Loading physio object from {input_file}")
5645
if not fs:
5746
fs = None

0 commit comments

Comments
 (0)