openPMD-viewer icon indicating copy to clipboard operation
openPMD-viewer copied to clipboard

Erroneus shell commands after extensive ts.iterate

Open n01r opened this issue 1 year ago • 1 comments

Hi, I noticed that when I would run a ts.iterate over many output iterations on OLCF's Jupyter Service and afterwards I would try to simply create a directory with a magic command from a Jupyter cell (! mkdir <path/to/dir>) the directory would get created but I would receive an error that reads: ValueError: filedescriptor out of range in select()

openpmd-viewer version: 1.6.0

To reproduce:

  • run WarpX sim and write openPMD output
  • read in large time series (e.g. 500 iterations)
  • execute in separate cells:
    ts = LpaDiagnostics('diags/diag_btd/')
    ex, ey = ts.iterate( ts.get_emittance ) # Emittance as a function of time
    g, _ = ts.iterate( ts.get_energy_spread, property='gamma' ) # Mean energy as a function of time
    ! mkdir -p "analysis"
    
full error message
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[6], line 1
----> 1 get_ipython().system(' mkdir -p "analysis"')

File /gpfs/alpine/proj-shared/aph114/mgarten/environments/conda-warpx/lib/python3.10/site-packages/ipykernel/zmqshell.py:649, in ZMQInteractiveShell.system_piped(self, cmd)
    647         self.user_ns["_exit_code"] = system(cmd)
    648 else:
--> 649     self.user_ns["_exit_code"] = system(self.var_expand(cmd, depth=1))

File /gpfs/alpine/proj-shared/aph114/mgarten/environments/conda-warpx/lib/python3.10/site-packages/IPython/utils/_process_posix.py:153, in ProcessHandler.system(self, cmd)
    149 flush = sys.stdout.flush
    150 while True:
    151     # res is the index of the pattern that caused the match, so we
    152     # know whether we've finished (if we matched EOF) or not
--> 153     res_idx = child.expect_list(patterns, self.read_timeout)
    154     print(child.before[out_size:].decode(enc, 'replace'), end='')
    155     flush()

File /gpfs/alpine/proj-shared/aph114/mgarten/environments/conda-warpx/lib/python3.10/site-packages/pexpect/spawnbase.py:372, in SpawnBase.expect_list(self, pattern_list, timeout, searchwindowsize, async_, **kw)
    370     return expect_async(exp, timeout)
    371 else:
--> 372     return exp.expect_loop(timeout)

File /gpfs/alpine/proj-shared/aph114/mgarten/environments/conda-warpx/lib/python3.10/site-packages/pexpect/expect.py:169, in Expecter.expect_loop(self, timeout)
    167     return self.timeout()
    168 # Still have time left, so read more data
--> 169 incoming = spawn.read_nonblocking(spawn.maxread, timeout)
    170 if self.spawn.delayafterread is not None:
    171     time.sleep(self.spawn.delayafterread)

File /gpfs/alpine/proj-shared/aph114/mgarten/environments/conda-warpx/lib/python3.10/site-packages/pexpect/pty_spawn.py:458, in spawn.read_nonblocking(self, size, timeout)
    450         return select_ignore_interrupts([self.child_fd], [], [], timeout)[0]
    452 # If there is data available to read right now, read as much as
    453 # we can. We do this to increase performance if there are a lot
    454 # of bytes to be read. This also avoids calling isalive() too
    455 # often. See also:
    456 # * https://github.com/pexpect/pexpect/pull/304
    457 # * http://trac.sagemath.org/ticket/10295
--> 458 if select(0):
    459     try:
    460         incoming = super(spawn, self).read_nonblocking(size)

File /gpfs/alpine/proj-shared/aph114/mgarten/environments/conda-warpx/lib/python3.10/site-packages/pexpect/pty_spawn.py:450, in spawn.read_nonblocking.<locals>.select(timeout)
    449 def select(timeout):
--> 450     return select_ignore_interrupts([self.child_fd], [], [], timeout)[0]

File /gpfs/alpine/proj-shared/aph114/mgarten/environments/conda-warpx/lib/python3.10/site-packages/pexpect/utils.py:143, in select_ignore_interrupts(iwtd, owtd, ewtd, timeout)
    141 while True:
    142     try:
--> 143         return select.select(iwtd, owtd, ewtd, timeout)
    144     except InterruptedError:
    145         err = sys.exc_info()[1]

ValueError: filedescriptor out of range in select()

n01r avatar Mar 22 '23 21:03 n01r

Thanks for the details!

After revisiting, the stacktrace, I think that is a problem with the Jupyter deployment at OLCF and should be reported in a ticket there.

You might be able to trigger it as well without openPMD-viewer, e.g., by running a busy loop first....?

ax3l avatar Apr 20 '23 18:04 ax3l