%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= irene4398.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 irene4398.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/6413731irene4398.c-irene.mg1.tgcc.ccc.cea.fr_SEDNA_DELTA_MONITOR_01M_AWTMD/ CPU times: user 498 ms, sys: 129 ms, total: 626 ms Wall time: 19.9 s
Client-6664e538-1343-11ed-878a-080038b931c3
Connection method: Cluster object | Cluster type: distributed.LocalCluster |
Dashboard: http://127.0.0.1:8787/status |
67075be3
Dashboard: http://127.0.0.1:8787/status | Workers: 16 |
Total threads: 128 | Total memory: 251.06 GiB |
Status: running | Using processes: True |
Scheduler-42333fd6-8e6e-441f-9693-fdb4665a03bf
Comm: tcp://127.0.0.1:45743 | 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:34010 | Total threads: 8 |
Dashboard: http://127.0.0.1:40356/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:33210 | |
Local directory: /tmp/dask-worker-space/worker-3334v3m3 |
Comm: tcp://127.0.0.1:44355 | Total threads: 8 |
Dashboard: http://127.0.0.1:37306/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:34260 | |
Local directory: /tmp/dask-worker-space/worker-5nan2251 |
Comm: tcp://127.0.0.1:34238 | Total threads: 8 |
Dashboard: http://127.0.0.1:44670/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:37189 | |
Local directory: /tmp/dask-worker-space/worker-rd8vn3a3 |
Comm: tcp://127.0.0.1:41228 | Total threads: 8 |
Dashboard: http://127.0.0.1:34949/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:35821 | |
Local directory: /tmp/dask-worker-space/worker-_bpfvaiv |
Comm: tcp://127.0.0.1:42375 | Total threads: 8 |
Dashboard: http://127.0.0.1:37152/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:46375 | |
Local directory: /tmp/dask-worker-space/worker-5dequr7r |
Comm: tcp://127.0.0.1:40838 | Total threads: 8 |
Dashboard: http://127.0.0.1:36156/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:33277 | |
Local directory: /tmp/dask-worker-space/worker-ys9n4dlv |
Comm: tcp://127.0.0.1:35399 | Total threads: 8 |
Dashboard: http://127.0.0.1:40675/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:39539 | |
Local directory: /tmp/dask-worker-space/worker-mg0o1n4g |
Comm: tcp://127.0.0.1:42812 | Total threads: 8 |
Dashboard: http://127.0.0.1:39483/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:38055 | |
Local directory: /tmp/dask-worker-space/worker-eca507b2 |
Comm: tcp://127.0.0.1:37038 | Total threads: 8 |
Dashboard: http://127.0.0.1:44412/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:41364 | |
Local directory: /tmp/dask-worker-space/worker-z59w_0nv |
Comm: tcp://127.0.0.1:45644 | Total threads: 8 |
Dashboard: http://127.0.0.1:38497/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:42935 | |
Local directory: /tmp/dask-worker-space/worker-9f0s52fd |
Comm: tcp://127.0.0.1:41481 | Total threads: 8 |
Dashboard: http://127.0.0.1:36995/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:45744 | |
Local directory: /tmp/dask-worker-space/worker-exzzuo0r |
Comm: tcp://127.0.0.1:33941 | Total threads: 8 |
Dashboard: http://127.0.0.1:39858/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:45440 | |
Local directory: /tmp/dask-worker-space/worker-m3p5slox |
Comm: tcp://127.0.0.1:38831 | Total threads: 8 |
Dashboard: http://127.0.0.1:36949/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:41140 | |
Local directory: /tmp/dask-worker-space/worker-4jl2zk6l |
Comm: tcp://127.0.0.1:33352 | Total threads: 8 |
Dashboard: http://127.0.0.1:44401/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:42658 | |
Local directory: /tmp/dask-worker-space/worker-u4qqnrkr |
Comm: tcp://127.0.0.1:38952 | Total threads: 8 |
Dashboard: http://127.0.0.1:36536/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:33760 | |
Local directory: /tmp/dask-worker-space/worker-og7qvyz2 |
Comm: tcp://127.0.0.1:42624 | Total threads: 8 |
Dashboard: http://127.0.0.1:45291/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:39992 | |
Local directory: /tmp/dask-worker-space/worker-xv3fgw9_ |
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 | |
---|---|---|---|---|---|---|---|---|---|---|
AW_maxtemp_depth | gridT.votemper,gridS.vosaline,param.mask,param... | calc.AWTD4(data) | ALL | AWTD_map | jet | (0,800) | m | M-5 |
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 394 µs, sys: 50 µs, total: 444 µs Wall time: 422 µ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'