Skip to content
Snippets Groups Projects
Commit 20b5a798 authored by Fabian Wachsmann's avatar Fabian Wachsmann
Browse files

Debugged open store

parent e3eb6d43
No related branches found
No related tags found
1 merge request!1To class
...@@ -9,11 +9,12 @@ import shutil ...@@ -9,11 +9,12 @@ import shutil
import math import math
from tqdm import tqdm from tqdm import tqdm
class Tzis(SwiftStore): class Tzis():
def __init__(self, def __init__(self,
os_url, os_url,
os_token, os_token,
os_container, os_container,
os_name=None,
mf_dset=None, mf_dset=None,
varname=None, varname=None,
verbose=False verbose=False
...@@ -21,8 +22,8 @@ class Tzis(SwiftStore): ...@@ -21,8 +22,8 @@ class Tzis(SwiftStore):
self.auth = { self.auth = {
"preauthurl": os_url, "preauthurl": os_url,
"preauthtoken": os_token, "preauthtoken": os_token,
} }
SwiftStore.__init__(self, os_container, "", self.auth) self.store=SwiftStore(os_container, prefix=os_name, storage_options=self.auth)
self.verbose=verbose self.verbose=verbose
# #
self.mf_dset=self.open_mf_dataset(mf_dset) self.mf_dset=self.open_mf_dataset(mf_dset)
...@@ -50,9 +51,8 @@ class Tzis(SwiftStore): ...@@ -50,9 +51,8 @@ class Tzis(SwiftStore):
return varname return varname
def open_store(self, os_name): def open_store(self, os_name):
self._SwiftStore = SwiftStore(container=self._SwiftStore.container, self.store.prefix=os_name
prefix=os_name, return self.store
storage_options=self.auth)
# `getSizeOfVarTimeseries` # `getSizeOfVarTimeseries`
# returns the size of the variable `varname`of the entire dataset `ds` used for chunking. Dataset can be multiple files. # returns the size of the variable `varname`of the entire dataset `ds` used for chunking. Dataset can be multiple files.
# #
...@@ -284,14 +284,14 @@ class Tzis(SwiftStore): ...@@ -284,14 +284,14 @@ class Tzis(SwiftStore):
if len(timevars) > 0: if len(timevars) > 0:
self.write_with_validation_and_retries(self.mf_dset, self.write_with_validation_and_retries(self.mf_dset,
self.varname, self.varname,
self._SwiftStore, self.store,
chunkdim, chunkdim,
target_mb, target_mb,
startchunk, startchunk,
validity_check, validity_check,
maxretries) maxretries)
else: else:
self.write_directly(self.mf_dset, self._SwiftStore) self.write_directly(self.mf_dset, self.store)
self.mf_dset.close() self.mf_dset.close()
# In[17]: # In[17]:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment