Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FSL
funpack
Commits
01322b75
Commit
01322b75
authored
Jun 22, 2022
by
Paul McCarthy
🚵
Browse files
MNT: Mark broadcasting for removal
parent
09cf2c48
Changes
2
Hide whitespace changes
Inline
Side-by-side
funpack/main.py
View file @
01322b75
...
...
@@ -631,11 +631,16 @@ def configLogging(args):
logging
.
getLogger
(
'funpack'
).
setLevel
(
loglevel
)
if
args
.
quiet
or
args
.
noisy
<
3
:
if
args
.
noisy
<
3
:
warnings
.
filterwarnings
(
'ignore'
,
module
=
'pandas'
)
warnings
.
filterwarnings
(
'ignore'
,
module
=
'numpy'
)
warnings
.
filterwarnings
(
'ignore'
,
module
=
'tables'
)
# print deprecation warnings
# at any verbosity level
if
args
.
noisy
>=
1
:
warnings
.
filterwarnings
(
'default'
,
category
=
DeprecationWarning
)
if
args
.
noisy
==
1
:
makequiet
=
[
'funpack.expression'
,
'funpack.custom'
,
...
...
funpack/processing.py
View file @
01322b75
...
...
@@ -94,6 +94,10 @@ in the processing table.
Broadcasting arguments
----------------------
.. warning:: Broadcasting arguments are deprecated, and will be removed in
FUNPACK 4.0.0. The alternative to broadcasting is for processing
functions to perform their own parallelisation.
When a process is applied independently to more than one variable, the input
arguments to the process may need to be different for each variable. This can
be accomplished by using a _broadcast_ argument - simply prefix the argument
...
...
@@ -124,6 +128,7 @@ import os
import
glob
import
logging
import
tempfile
import
warnings
import
collections
import
collections.abc
as
abc
...
...
@@ -379,12 +384,13 @@ def runParallelProcess(proc, dtable, vids, workDir, broadcastIndex=None):
a worker process - this is used to reduce the
amount of data that must be transferred between
processes.
:arg broadcastIndex: Index to use for broadcast arguments -
passed
through to the :meth:`Process.run` method.
:arg broadcastIndex:
Deprecated.
Index to use for broadcast arguments -
passed
through to the :meth:`Process.run` method.
:returns: A tuple containing:
- A reference to ``dtable``
- the result of ``proc.run()``
"""
os
.
mkdir
(
workDir
)
result
=
proc
.
run
(
dtable
,
vids
,
broadcastIndex
=
broadcastIndex
)
remove
,
add
,
addvids
,
addkwargs
=
unpackResults
(
proc
,
result
)
...
...
@@ -489,8 +495,9 @@ class Process:
:arg procstr: Input string containing the process specification.
Any keyword arguments which begin with ``'broadcast_'`` are separated
out the other keyword arguments - see the :meth:`run` method for more
details.
out the other keyword arguments, although note that broadcasting is
deprecated and will be removed in FUNPACK 4.0.0. See the :meth:`run`
method for more details.
"""
bcastKwargs
=
collections
.
OrderedDict
()
...
...
@@ -498,6 +505,9 @@ class Process:
for
k
,
v
in
kwargs
.
items
():
if
k
.
startswith
(
'broadcast_'
):
warnings
.
warn
(
f
'[
{
k
}
]: Broadcasting is deprecated, and '
'will be removed in FUNPACK 4.0.0 '
,
DeprecationWarning
)
k
=
'_'
.
join
(
k
.
split
(
'_'
)[
1
:])
bcastKwargs
[
k
]
=
v
else
:
...
...
@@ -608,11 +618,11 @@ class Process:
"""Run the process on the data, passing it the given arguments,
and any arguments that were passed to :meth:`__init__`.
:arg broadcastIndex: If provided, and if any broadcast
arguments
were specified for this process, this
index is
used to retrieve one value each
broadcast argument
list - this value is then
passed to the process
function.
:arg broadcastIndex:
Deprecated.
If provided, and if any broadcast
arguments
were specified for this process, this
index is
used to retrieve one value each
broadcast argument
list - this value is then
passed to the process
function.
"""
kwargs
=
self
.
__kwargs
.
copy
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment