%matplotlib inline
import pandas as pd
import socket
host = socket.getfqdn()
from core import load, zoom, calc, save,plots,monitor
#reload funcs after updating ./core/*.py
import importlib
importlib.reload(load)
importlib.reload(zoom)
importlib.reload(calc)
importlib.reload(save)
importlib.reload(plots)
importlib.reload(monitor)
<module 'core.monitor' from '/ccc/work/cont003/gen7420/odakatin/monitor-sedna/notebook/core/monitor.py'>
# 'month': = 'JOBID' almost month but not really,
# If you submit the job with job scheduler, above
#below are list of enviroment variable one can pass
#%env local='2"
# local : if True run dask local cluster, if not true, put number of workers
# setted in the 'local'
# if no 'local ' given, local will be setted automatically to 'True'
#%env ychunk='2'
#%env tchunk='2'
# controls chunk. 'False' sets no modification from original netcdf file's chunk.
# ychunk=10 will group the original netcdf file to 10 by 10
# tchunk=1 will chunk the time coordinate one by one
#%env control=FWC_SSH
# name of control file to be used for computation/plots/save/
#%env file_exp=
# 'file_exp': Which 'experiment' name is it?
#. this corresopnds to intake catalog name without path and .yaml
#%env year=
# for Validation, this correspoinds to path/year/month 's year
# for monitoring, this corresponids to 'date' having * means do all files in the monitoring directory
# setting it as *0[0-9] &*1[0-9]& *[2-3][0-9], the job can be separated in three lots.
#%env month=
# for monitoring this corresponds to file path path-XIOS.{month}/
#
#%env save= proceed saving? True or False , Default is setted as True
#%env plot= proceed plotting? True or False , Default is setted as True
#%env calc= proceed computation? or just load computed result? True or False , Default is setted as True
#%env save=False
#%env lazy=False
%%time
# 'savefig': Do we save output in html? or not. keep it true.
savefig=True
client,cluster,control,catalog_url,month,year,daskreport,outputpath = load.set_control(host)
!mkdir -p $outputpath
!mkdir -p $daskreport
client
local True using host= irene4740.c-irene.mg1.tgcc.ccc.cea.fr starting dask cluster on local= True workers 16 10000000000 False rome local cluster starting This code is running on irene4740.c-irene.mg1.tgcc.ccc.cea.fr using SEDNA_DELTA_MONITOR file experiment, read from ../lib/SEDNA_DELTA_MONITOR.yaml on year= 2012 on month= 01 outputpath= ../results/SEDNA_DELTA_MONITOR/ daskreport= ../results/dask/6413733irene4740.c-irene.mg1.tgcc.ccc.cea.fr_SEDNA_DELTA_MONITOR_01M_Sectiony/ CPU times: user 562 ms, sys: 124 ms, total: 685 ms Wall time: 20.3 s
Client-67f55628-1343-11ed-98b3-080038b93edd
Connection method: Cluster object | Cluster type: distributed.LocalCluster |
Dashboard: http://127.0.0.1:8787/status |
64a8911e
Dashboard: http://127.0.0.1:8787/status | Workers: 16 |
Total threads: 128 | Total memory: 251.06 GiB |
Status: running | Using processes: True |
Scheduler-17ced8c2-9c4c-469d-9fc7-6b6160545fe6
Comm: tcp://127.0.0.1:46244 | Workers: 16 |
Dashboard: http://127.0.0.1:8787/status | Total threads: 128 |
Started: Just now | Total memory: 251.06 GiB |
Comm: tcp://127.0.0.1:38680 | Total threads: 8 |
Dashboard: http://127.0.0.1:44374/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:40710 | |
Local directory: /tmp/dask-worker-space/worker-zj3c3v3j |
Comm: tcp://127.0.0.1:43456 | Total threads: 8 |
Dashboard: http://127.0.0.1:46459/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:34074 | |
Local directory: /tmp/dask-worker-space/worker-osir2d3r |
Comm: tcp://127.0.0.1:40079 | Total threads: 8 |
Dashboard: http://127.0.0.1:34599/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:46138 | |
Local directory: /tmp/dask-worker-space/worker-nti64boz |
Comm: tcp://127.0.0.1:43247 | Total threads: 8 |
Dashboard: http://127.0.0.1:39220/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:38323 | |
Local directory: /tmp/dask-worker-space/worker-84gakzdv |
Comm: tcp://127.0.0.1:37117 | Total threads: 8 |
Dashboard: http://127.0.0.1:35737/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:44723 | |
Local directory: /tmp/dask-worker-space/worker-ijmoh0tv |
Comm: tcp://127.0.0.1:42887 | Total threads: 8 |
Dashboard: http://127.0.0.1:35250/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:42177 | |
Local directory: /tmp/dask-worker-space/worker-8m7xkqaq |
Comm: tcp://127.0.0.1:35586 | Total threads: 8 |
Dashboard: http://127.0.0.1:37395/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:33074 | |
Local directory: /tmp/dask-worker-space/worker-dbu5_gnr |
Comm: tcp://127.0.0.1:42997 | Total threads: 8 |
Dashboard: http://127.0.0.1:43320/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:37301 | |
Local directory: /tmp/dask-worker-space/worker-op46u61_ |
Comm: tcp://127.0.0.1:46501 | Total threads: 8 |
Dashboard: http://127.0.0.1:36860/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:38856 | |
Local directory: /tmp/dask-worker-space/worker-8r8632_e |
Comm: tcp://127.0.0.1:32809 | Total threads: 8 |
Dashboard: http://127.0.0.1:44643/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:37100 | |
Local directory: /tmp/dask-worker-space/worker-orv9mhdf |
Comm: tcp://127.0.0.1:38639 | Total threads: 8 |
Dashboard: http://127.0.0.1:40448/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:38605 | |
Local directory: /tmp/dask-worker-space/worker-9v7chuf_ |
Comm: tcp://127.0.0.1:45010 | Total threads: 8 |
Dashboard: http://127.0.0.1:46511/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:41908 | |
Local directory: /tmp/dask-worker-space/worker-ql3c0vk_ |
Comm: tcp://127.0.0.1:37540 | Total threads: 8 |
Dashboard: http://127.0.0.1:42230/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:42102 | |
Local directory: /tmp/dask-worker-space/worker-7wlow2v9 |
Comm: tcp://127.0.0.1:43957 | Total threads: 8 |
Dashboard: http://127.0.0.1:37626/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:38980 | |
Local directory: /tmp/dask-worker-space/worker-tu7nbo6a |
Comm: tcp://127.0.0.1:38015 | Total threads: 8 |
Dashboard: http://127.0.0.1:41359/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:43086 | |
Local directory: /tmp/dask-worker-space/worker-97a9h2w5 |
Comm: tcp://127.0.0.1:44392 | Total threads: 8 |
Dashboard: http://127.0.0.1:36558/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:44639 | |
Local directory: /tmp/dask-worker-space/worker-i0ftu6nk |
df=load.controlfile(control)
#Take out 'later' tagged computations
#df=df[~df['Value'].str.contains('later')]
df
Value | Inputs | Equation | Zone | Plot | Colourmap | MinMax | Unit | Oldname | Unnamed: 10 | |
---|---|---|---|---|---|---|---|---|---|---|
Section | gridT.votemper,gridS.vosaline,gridV.vomecrty,p... | data.unify_chunks().persist() | FramS | section | None | {'vosaline': (33,36.2), 'votemper': (-2,6), 'v... | None | S-1 |
Each computation consists of
%%time
import os
calcswitch=os.environ.get('calc', 'True')
lazy=os.environ.get('lazy','False' )
loaddata=((df.Inputs != '').any())
print('calcswitch=',calcswitch,'df.Inputs != nothing',loaddata, 'lazy=',lazy)
data = load.datas(catalog_url,df.Inputs,month,year,daskreport,lazy=lazy) if ((calcswitch=='True' )*loaddata) else 0
data
calcswitch= False df.Inputs != nothing True lazy= False CPU times: user 356 µs, sys: 0 ns, total: 356 µs Wall time: 356 µs
0
%%time
monitor.auto(df,data,savefig,daskreport,outputpath,file_exp='SEDNA'
)
#calc= False #save= False #plot= True
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) File <timed eval>:1, in <module> File /ccc/work/cont003/gen7420/odakatin/monitor-sedna/notebook/core/monitor.py:26, in auto(df, val, savefig, daskreport, outputpath, file_exp) 23 print('#plot=',plotswitch ) 24 for step in df.itertuples(): 25 # 1. Create data set ---> 26 optimize_dataset(val) 27 data=val 28 Value=step.Value File /ccc/work/cont003/gen7420/odakatin/monitor-sedna/notebook/core/monitor.py:100, in optimize_dataset(ds) 98 def optimize_dataset(ds): 99 import dask --> 100 for varname, da in ds.data_vars.items(): 101 #print(varname) 102 da=da.data 103 (da,)=dask.optimize(da) AttributeError: 'int' object has no attribute 'data_vars'