Flexible Backend - AbstractDataStore definition
See original GitHub issueI just want to do a small recap of the current proposals for the class AbstractDataStore refactor discussed with @shoyer, @jhamman, and @alexamici.
Proposal 1: Store returns:
- xr.Variables with the list of filters to apply to every variable
- dataset attributes
- encodings
Xarray applies to every variable only the filters selected by the backend before building the xr.Dataset.
Proposal 2: Store returns:
- xr.Variables with all needed filters applied (configured by xarray),
- dataset attributes
- encodings
Xarray builds the xr.Dataset
Proposal 3: Store returns:
- xr.Dataset
Before going on I’d like to collect pros and cons. For my understanding:
Proposal 1
pros:
- the backend is free to decide which representation to provide.
- more control on the backend (? not necessary true, the backend can decide to apply all the filters internally and provide xarray and empty list of filters to be applied)
- enable / disable filters logic would be in xarray.
- all the filters (applied by xarray) should have a similar interface.
- maybe registered filters could be used by other backends
cons:
- confusing backend-xarray interface.
- more difficult to define interfaces. More conflicts (registered filters with the same name…)
- need more structure to define this interface, more code to maintain.
Proposal 2
pros:
- interface backend-xarray is clearer / backend and xarray have well different defined tasks.
- interface would be minimal and easier to implement
- no intermediate representations
- less code to maintain
cons:
- less control on filters.
- more complex explicit definition of the interface (every filter must understand what
decode_times
means in their case) - more complexity inside the filters
The minimal interface would be something like that:
class AbstractBackEnd:
def __init__(self, path, encode_times=True, ..., **kwargs): # signature of open_dataset
raise NotImplementedError
def get_variables():
"""Return a dictionary of variable name and xr.Variable"""
raise NotImplementedError
def get_attrs():
"""returns """
raise NotImplementedError
def get_encoding():
""" """
raise NotImplementedError
def close(self):
pass
Proposal 3
pros w.r.t. porposal 2:
- decode_coordinates is done by the backend as the other filters.
cons?
Any suggestions?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
A Backend with Flexibility - DEV Community
GraphQL is language and database agnostic meaning that it can be implemented with a variety of programming languages and backed by any database ......
Read more >How to create a flexible backend software architecture
This article teaches about how to implement a flexible backend architecture at the granular level with a practical example demonstrated ...
Read more >Index (controller-docs 4.0.4 API) - javadoc.io
AbstractDataStore (ActorSystem, ClusterWrapper, Configuration, ... This class represents the following YANG schema fragment defined in module cluster-admin.
Read more >What are front end and back end? Definition from WhatIs.com
The back end refers to parts of a computer application or a program's code that allow it to operate and that cannot be...
Read more >Lutece ramen plugin – Project Dependencies
... provides a simple yet flexible means of adding support for multipart file upload ... Description: Abstract datastore implementation and helper classes.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks @alexamici
I’m a bit behind here: what’s an example of a filter? A selection of the data?
Edit: as discussed filter == encoding
I’m looking at other bits of knowledge of how backends work that are still present in the generic parts of
open_dataset
.We see
_autodetect_engine
and_normalize_path
.We aim at removing
_autodetect_engine
in favour of adding a newcan_open(filename_or_obj, ...)
backend function declared via the plugin interface.On the other hand
_normalize_path
can be removed entirely onceZarrStore.open_group
will acceptos.PathLike
objects.