Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
adaptive
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Quantum Tinkerer
adaptive
Commits
19a0fb83
Commit
19a0fb83
authored
7 years ago
by
Joseph Weston
Browse files
Options
Downloads
Patches
Plain Diff
correct checks for ipyparallel clients
parent
73fa8d28
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
adaptive/runner.py
+8
-6
8 additions, 6 deletions
adaptive/runner.py
with
8 additions
and
6 deletions
adaptive/runner.py
+
8
−
6
View file @
19a0fb83
...
@@ -84,10 +84,11 @@ class _AsyncExecutor:
...
@@ -84,10 +84,11 @@ class _AsyncExecutor:
def
_ensure_async_executor
(
executor
,
ioloop
):
def
_ensure_async_executor
(
executor
,
ioloop
):
if
isinstance
(
executor
,
concurrent
.
Executor
):
if
isinstance
(
executor
,
ipyparallel
.
Client
):
pass
elif
isinstance
(
executor
,
ipyparallel
.
Client
):
executor
=
executor
.
executor
()
executor
=
executor
.
executor
()
elif
isinstance
(
executor
,
(
concurrent
.
ProcessPoolExecutor
,
concurrent
.
ThreadPoolExecutor
)):
pass
elif
executor
is
None
:
elif
executor
is
None
:
executor
=
concurrent
.
ProcessPoolExecutor
()
executor
=
concurrent
.
ProcessPoolExecutor
()
else
:
else
:
...
@@ -102,10 +103,11 @@ def _get_executor_ncores(executor):
...
@@ -102,10 +103,11 @@ def _get_executor_ncores(executor):
if
isinstance
(
executor
,
_AsyncExecutor
):
if
isinstance
(
executor
,
_AsyncExecutor
):
executor
=
executor
.
executor
executor
=
executor
.
executor
if
isinstance
(
executor
,
concurrent
.
Executor
):
if
isinstance
(
executor
,
ipyparallel
.
client
.
view
.
ViewExecutor
):
return
len
(
executor
.
view
)
elif
isinstance
(
executor
,
(
concurrent
.
ProcessPoolExecutor
,
concurrent
.
ThreadPoolExecutor
)):
return
executor
.
_max_workers
# not public API!
return
executor
.
_max_workers
# not public API!
elif
isinstance
(
executor
,
ipyparallel
.
Client
):
return
len
(
executor
)
else
:
else
:
raise
TypeError
(
'
Only concurrent.futures.Executors or ipyparallel
'
raise
TypeError
(
'
Only concurrent.futures.Executors or ipyparallel
'
'
clients can be used.
'
)
'
clients can be used.
'
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment