Skip to content

Commit

Permalink
Merge branch 'slurmoverssh'
Browse files Browse the repository at this point in the history
  • Loading branch information
francoislaurent committed Nov 9, 2020
2 parents 27b3bd8 + ac8dc1e commit 48d2b07
Show file tree
Hide file tree
Showing 19 changed files with 745 additions and 169 deletions.
14 changes: 2 additions & 12 deletions containers/tramway-notebook
Original file line number Diff line number Diff line change
Expand Up @@ -58,27 +58,17 @@ The container OS is Ubuntu Xenial and can run on top of old OSes like CentOS6.

#pip3.6 install --upgrade pip
pip3.6 uninstall -qy tramway || true
pip3.6 install . -r requirements.txt
#pip3.6 install . -r requirements.txt
pip3.6 install .[animate,roi,webui]

pip3.6 install scikit-learn
pip3.6 install paramiko
pip3.6 install notebook

#apt-get install -y --no-install-recommends \
# firefox firefox-geckodriver
pip3.6 install colorcet

mkdir -p /pasteur

%runscript

#cmd="tramway"
#python="python3.6"
#if [ -n "$1" -a "$1" = "-s" ]; then
# cmd="${python} -s -m tramway"
# shift
#fi
#exec $cmd $@

exec jupyter notebook $@

9 changes: 6 additions & 3 deletions scripts/tramway-browse
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import tempfile as tmp
import sys
import subprocess

def browse(files=[], browser='Firefox'):
def browse(files=[], browser='Firefox', colormap=None):
if not files:
import glob
filepattern = '*.rwa'
Expand All @@ -25,8 +25,10 @@ from selenium import webdriver
a = RWAnalyzer()
a.spt_data.from_rwa_files(['{}'])
a.env.script = '{}'
a.browser.show_maps(webdriver=webdriver.{})
""".format("', '".join(files), script.name, browser)
{}a.browser.show_maps(webdriver=webdriver.{})
""".format("', '".join(files), script.name,
'' if colormap is None else "a.browser.colormap = '{}'\n".format(colormap),
browser)
script.write(source)
script.flush()
try:
Expand All @@ -43,6 +45,7 @@ def main():
description='Browse TRamWAy-generated .rwa files')
parser.add_argument('files', nargs='*', help='for example: *.rwa or */*.rwa')
parser.add_argument('--browser', default='Firefox', choices=['Firefox','Chrome','Edge','Ie','Opera','Safari','WebKitGTK'])
parser.add_argument('--colormap', help="Matplotlib colormap name")
print(browse(**parser.parse_args().__dict__))

if __name__ == '__main__':
Expand Down
15 changes: 15 additions & 0 deletions tramway/analyzer/browser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,26 @@ class Browser(AnalyzerNode):
The showed parameter values can also be exported with the side panel.
Note that all features are exported together with the spatial bin center coordinates.
"""
__slots__ = ('_colormap',)
@property
def colormap(self):
""" Colormap for inferred parameter maps.
See also :func:`~tramway.plot.bokeh.map.scalar_map_2d`."""
return self._colormap
@colormap.setter
def colormap(self, cm):
self._colormap = cm
def __init__(self, analyzer):
AnalyzerNode.__init__(self, parent=analyzer)
self._colormap = None
def show_maps(self, **kwargs):
""" see also :func:`~tramway.plot.bokeh.analyzer.browse_maps`. """
from tramway.plot.bokeh.analyzer import browse_maps
browse_maps(self._eldest_parent, **kwargs)

Attribute.register(Browser)


__all__ = ['Browser']

31 changes: 22 additions & 9 deletions tramway/analyzer/env/environments.py
Original file line number Diff line number Diff line change
Expand Up @@ -1029,19 +1029,32 @@ def wait_for_job_completion(self):
self.logger.error(err.rstrip())
elif out:
# parse and print progress info
out = out.splitlines()
try:
start, stop = out[0].split()[0].split('-')
except ValueError:
raise RuntimeError('unexpected squeue message: \n'+'\n'.join(out))
stop = stop.split('%')[0]
start, stop = int(start), int(stop)
start, _out = None, []
_continue = False
for line in out.splitlines():
parts = line.split()
if '-' in parts[0]:
if start is None:
try:
start, stop = parts[0].split('-')
except ValueError:
self.logger.debug('squeue output parsing failed: \n'+out)
_continue = True; break
else:
stop = stop.split('%')[0]
start, stop = int(start), int(stop)
else:
self.logger.debug('squeue output parsing failed: \n'+out)
_continue = True; break
else:
_out.append(parts)
if _continue:
continue
total = stop
pending = stop - start
running = 0
other = 0
for out in out[1:]:
out = out.split()
for out in _out:
array_ix, status, time_used = int(out[0]), out[1], out[2]
reason = ' '.join(out[3:])
if status == 'R':
Expand Down

0 comments on commit 48d2b07

Please sign in to comment.