ipython / ipython/ipyparallel

Packages and definitions loaded in the regular kernel are not known by engines and vice versa

Aberta
#897 12 comentários 0 reações 0 responsáveis Ver no GitHub
question
Linguagem predominante
Jupyter Notebook
Estrelas
2.6k
Forks
1k
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

Importing modules or defining functions in regular cells (without the `%%px` magic) are not known in cells where the `%%px` macro is used.

The same is true for the other way around.

To reproduce this try

```py
# Cell 1
import ipyparallel as ipp
from mpi4py import MPI

# Cell 2
cluster = ipp.Cluster(engines="mpi", n=4)
clients = cluster.start_and_connect_sync()

# Cell 3
%%px
import sys

def abc():
print('abc')

# Cell 4
import os
def cde():
print('cde')

# Cell 5:
%%px
os.getpid()
cde()

# Cell 6:
sys.getsizeof(0.0)
abc()
```

Cell 5 and Cell 6 will fail on both statements in each.

A global `%autopx` would ensure that everything runs on the engines, which makes development kind of inconvenient (e.g. prints are done on all engines and so on).
Defining different views and activating them according to how many engines are needed, e.g. one for development with a single engine, seems overkill.

What is the recommended approach to solve the outlined problem?

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

Start by reproducing the five-cell example with %%px and the regular kernel, then inspect the documented behavior of %%px and %autopx. The issue does not name implementation files or tests; done would require an agreed approach that makes definitions and imports available across the two execution contexts without requiring global %autopx.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
jupyter, jupyter-notebook, python
Domínio
distributed-systems
Tipo de issue
Bug
Dificuldade
5/5
Tempo estimado
Mais de uma semana
Status de atividade
Estagnada
Clareza
Precisa de esclarecimento
Facilidade para iniciantes
25/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.