gavo.protocols.datalink module¶
The datalink core and its numerous helper classes.
More on this in “Datalink Cores” in the reference documentation.
- class gavo.protocols.datalink.DLFITSProductDescriptor(*args, **kwargs)[source]¶
Bases:
FITSProductDescriptor
A SODA descriptor for FITS files with datalink product paths.
Use is as descClass in //soda#fits_genDesc when the product table has a datalink as the product.
- class gavo.protocols.datalink.DataFormatter(parent, **kwargs)[source]¶
Bases:
ProcApp
A procedure application that renders data in a processed service.
These play the role of the renderer, which for datalink is usually trivial. They are supposed to take descriptor.data and return a pair of (mime-type, bytes), which is understood by most renderers.
When no dataFormatter is given for a core, it will return descriptor.data directly. This can work with the datalink renderer itself if descriptor.data will work as a nevow resource (i.e., has a renderHTTP method, as our usual products do). Consider, though, that renderHTTP runs in the main event loop and thus most not block for extended periods of time.
- The following names are available to the code:
descriptor – whatever the DescriptorGenerator returned
args – all the arguments that came in from the web.
- In addition to the usual names available to ProcApps, data formatters have:
Page – base class for resources with renderHTTP methods.
IRequest – the nevow interface to make Request objects with.
- File(path, type) – if you just want to return a file on disk, pass
its path and media type to File and return the result.
- TemporaryFile(path, type) – as File, but the disk file is unlinked
after use
soda – the protocols.soda module
- additionalNamesForProcs = {'File': <class 'gavo.protocols.datalink._File'>, 'IRequest': <function DataFormatter.<lambda>>, 'Page': <class 'gavo.formal.nevowc.TemplatedPage'>, 'TemporaryFile': <class 'gavo.protocols.datalink._TemporaryFile'>, 'soda': <module 'gavo.protocols.soda' from '/home/msdemlei/gavo/trunk/gavo/protocols/soda.py'>}¶
- attrSeq = [<gavo.base.complexattrs.StructListAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.parsecontext.IdAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.parsecontext.OriginalAttribute object>, <gavo.base.parsecontext.ReferenceAttribute object>, <gavo.base.complexattrs.StructListAttribute object>, <gavo.base.attrdef.EnumeratedUnicodeAttribute object>]¶
- completedCallbacks = []¶
- formalArgs = 'descriptor, args'¶
- managedAttrs = {'bind': <gavo.base.complexattrs.StructListAttribute object>, 'bindings': <gavo.base.complexattrs.StructListAttribute object>, 'code': <gavo.base.attrdef.UnicodeAttribute object>, 'deprecated': <gavo.base.attrdef.UnicodeAttribute object>, 'doc': <gavo.base.attrdef.UnicodeAttribute object>, 'id': <gavo.base.parsecontext.IdAttribute object>, 'name': <gavo.base.attrdef.UnicodeAttribute object>, 'original': <gavo.base.parsecontext.OriginalAttribute object>, 'procDef': <gavo.base.parsecontext.ReferenceAttribute object>, 'setup': <gavo.base.complexattrs.StructListAttribute object>, 'setups': <gavo.base.complexattrs.StructListAttribute object>, 'type': <gavo.base.attrdef.EnumeratedUnicodeAttribute object>}¶
- name_ = 'dataFormatter'¶
- requiredType = 'dataFormatter'¶
- class gavo.protocols.datalink.DataFunction(parent, **kwargs)[source]¶
Bases:
ProcApp
A procedure application that generates or modifies data in a processed data service.
All these operate on the data attribute of the product descriptor. The first data function plays a special role: It must set the data attribute (or raise some appropriate exception), or a server error will be returned to the client.
What is returned depends on the service, but typcially it’s going to be a table or products.*Product instance.
Data functions can shortcut if it’s evident that further data functions can only mess up (i.e., if the do something bad with the data attribute); you should not shortcut if you just think it makes no sense to further process your output.
To shortcut, raise either of FormatNow (falls though to the formatter, which is usually less useful) or DeliverNow (directly returns the data attribute; this can be used to return arbitrary chunks of data).
- The following names are available to the code:
descriptor – whatever the DescriptorGenerator returned
args – all the arguments that came in from the web.
- In addition to the usual names available to ProcApps, data functions have:
FormatNow – exception to raise to go directly to the formatter
- DeliverNow – exception to raise to skip all further formatting
and just deliver what’s currently in descriptor.data
- File(path, type) – if you just want to return a file on disk, pass
its path and media type to File and assign the result to descriptor.data.
- TemporaryFile(path,type) – as File, but the disk file is
unlinked after use
makeData – the rsc.makeData function
soda – the protocols.soda module
RemoteProduct(url) – 301-redirects to URL when rendered
- additionalNamesForProcs = {'DataFromURL': <bound method RemoteProduct.fromURL of <class 'gavo.protocols.products.RemoteProduct'>>, 'DeliverNow': <class 'gavo.protocols.soda.DeliverNow'>, 'File': <class 'gavo.protocols.datalink._File'>, 'FormatNow': <class 'gavo.protocols.soda.FormatNow'>, 'TemporaryFile': <class 'gavo.protocols.datalink._TemporaryFile'>, 'makeData': <function makeData>, 'soda': <module 'gavo.protocols.soda' from '/home/msdemlei/gavo/trunk/gavo/protocols/soda.py'>}¶
- attrSeq = [<gavo.base.complexattrs.StructListAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.parsecontext.IdAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.parsecontext.OriginalAttribute object>, <gavo.base.parsecontext.ReferenceAttribute object>, <gavo.base.complexattrs.StructListAttribute object>, <gavo.base.attrdef.EnumeratedUnicodeAttribute object>]¶
- completedCallbacks = []¶
- formalArgs = 'descriptor, args'¶
- managedAttrs = {'bind': <gavo.base.complexattrs.StructListAttribute object>, 'bindings': <gavo.base.complexattrs.StructListAttribute object>, 'code': <gavo.base.attrdef.UnicodeAttribute object>, 'deprecated': <gavo.base.attrdef.UnicodeAttribute object>, 'doc': <gavo.base.attrdef.UnicodeAttribute object>, 'id': <gavo.base.parsecontext.IdAttribute object>, 'name': <gavo.base.attrdef.UnicodeAttribute object>, 'original': <gavo.base.parsecontext.OriginalAttribute object>, 'procDef': <gavo.base.parsecontext.ReferenceAttribute object>, 'setup': <gavo.base.complexattrs.StructListAttribute object>, 'setups': <gavo.base.complexattrs.StructListAttribute object>, 'type': <gavo.base.attrdef.EnumeratedUnicodeAttribute object>}¶
- name_ = 'dataFunction'¶
- requiredType = 'dataFunction'¶
- class gavo.protocols.datalink.DatalinkCore(parent, **kwargs)[source]¶
Bases:
DatalinkCoreBase
A core for processing datalink and processed data requests.
The input table of this core is dynamically generated from its metaMakers; it makes no sense at all to try and override it.
See `Datalink and SODA`_ for more information.
In contrast to “normal” cores, one of these is made (and destroyed) for each datalink request coming in. This is because the interface of a datalink service depends on the request’s value(s) of ID.
The datalink core can produce both its own metadata and data generated. It is the renderer’s job to tell them apart.
- adaptForDescriptors(renderer, descriptors, maxRec)[source]¶
returns a core for renderer and a sequence of ProductDescriptors.
This method is mainly for helping adaptForRenderer. Do read the docstring there.
- adaptForRenderer(renderer, queryMeta)[source]¶
returns a core for a specific product.
The ugly thing about datalink in DaCHS’ architecture is that its interface (in terms of, e.g., inputKeys’ values children) depends on the arguments themselves, specifically the pubDID.
The workaround is to abuse the renderer-specific getCoreFor, ignore the renderer and instead steal an “args” variable from somewhere upstack. Nasty, but for now an acceptable solution.
It is particularly important to never let service cache the cores returned for the dl* renderers; hence to “nocache” magic.
This tries to generate all datalink-relevant metadata in one go and avoid calling the descriptorGenerator(s) more than once per pubDID. It therefore adds datalinkLinks, datalinkEndpoints, and descriptors attributes. These are used later in either metadata generation or data processing.
An additional complication is MAXREC; when adaptForDescriptors will crop the descriptor list if more than MAXREC links (incl. errors) are generated if the renderer is dlmeta. On dlget, MAXREC is ignored; we don’t really do multi-ID dlget right now, anyway.
The latter will in general use only the last pubDID passed in. Therefore, this last pubDID determines the service interface for now. Perhaps we should be joining the inputKeys in some way, though, e.g., if we want to allow retrieving multiple datasets in a tar file? Or to re-use the same service for all pubdids?
- attrSeq = [<gavo.base.complexattrs.StructAttribute object>, <gavo.base.complexattrs.StructListAttribute object>, <gavo.base.complexattrs.StructAttribute object>, <gavo.base.parsecontext.IdAttribute object>, <gavo.rscdef.common.ColumnListAttribute object>, <gavo.base.complexattrs.StructAttribute object>, <gavo.base.complexattrs.StructListAttribute object>, <gavo.base.parsecontext.OriginalAttribute object>, <gavo.base.complexattrs.StructAttribute object>, <gavo.base.complexattrs.PropertyAttribute object>, <gavo.rscdef.common.RDAttribute object>]¶
- clearProperty(name)¶
- completedCallbacks = []¶
- datalinkAdaptingRenderers = frozenset({'dlasync', 'dlget', 'dlmeta', 'form', 'ssap.xml'})¶
- datalinkType = 'application/x-votable+xml;content=datalink'¶
- finalize()[source]¶
breaks circular references to make the garbage collector’s job easier.
The core will no longer function once this has been called.
- getFullId()¶
- getProperty(name, default=<Undefined>)¶
- hasProperty(name)¶
- managedAttrs = {'dataFormatter': <gavo.base.complexattrs.StructAttribute object>, 'dataFunction': <gavo.base.complexattrs.StructListAttribute object>, 'dataFunctions': <gavo.base.complexattrs.StructListAttribute object>, 'descriptorGenerator': <gavo.base.complexattrs.StructAttribute object>, 'id': <gavo.base.parsecontext.IdAttribute object>, 'inputKey': <gavo.rscdef.common.ColumnListAttribute object>, 'inputKeys': <gavo.rscdef.common.ColumnListAttribute object>, 'inputTable': <gavo.base.complexattrs.StructAttribute object>, 'metaMaker': <gavo.base.complexattrs.StructListAttribute object>, 'metaMakers': <gavo.base.complexattrs.StructListAttribute object>, 'original': <gavo.base.parsecontext.OriginalAttribute object>, 'outputTable': <gavo.base.complexattrs.StructAttribute object>, 'properties': <gavo.base.complexattrs.PropertyAttribute object>, 'property': <gavo.base.complexattrs.PropertyAttribute object>, 'rd': <gavo.rscdef.common.RDAttribute object>}¶
- name_ = 'datalinkCore'¶
- overflowed = False¶
- property rd¶
- runForData(service, inputTable, queryMeta)[source]¶
returns a data set processed according to inputTable’s parameters.
- runForMeta(service, inputTable, queryMeta)[source]¶
returns a rendered VOTable containing the datalinks.
- setProperty(name, value)¶
- workerSystem = <gavo.protocols.dlasync.DLUWS object>¶
- class gavo.protocols.datalink.DatalinkCoreBase(parent, **kwargs)[source]¶
Bases:
Core
,ExpansionDelegator
Basic functionality for datalink cores.
This is pulled out of the datalink core proper as it is used without the complicated service interface sometimes, e.g., by SSAP.
- attrSeq = [<gavo.base.complexattrs.StructAttribute object>, <gavo.base.complexattrs.StructListAttribute object>, <gavo.base.complexattrs.StructAttribute object>, <gavo.base.parsecontext.IdAttribute object>, <gavo.rscdef.common.ColumnListAttribute object>, <gavo.base.complexattrs.StructAttribute object>, <gavo.base.complexattrs.StructListAttribute object>, <gavo.base.parsecontext.OriginalAttribute object>, <gavo.base.complexattrs.StructAttribute object>, <gavo.base.complexattrs.PropertyAttribute object>, <gavo.rscdef.common.RDAttribute object>]¶
- clearProperty(name)¶
- completedCallbacks = []¶
- getDatalinksResource(ctx, service)[source]¶
returns a VOTable RESOURCE element with the data links.
This does not contain the actual service definition elements, but it does contain references to them.
You must pass in a VOTable context object ctx (for the management of ids). If this is the entire content of the VOTable, use votablewrite.VOTableContext() there.
- getFullId()¶
- getMetaForDescriptor(descriptor)[source]¶
returns a pair of linkDefs, inputKeys for a datalink descriptor and this core.
- getProperty(name, default=<Undefined>)¶
- hasProperty(name)¶
- managedAttrs = {'dataFormatter': <gavo.base.complexattrs.StructAttribute object>, 'dataFunction': <gavo.base.complexattrs.StructListAttribute object>, 'dataFunctions': <gavo.base.complexattrs.StructListAttribute object>, 'descriptorGenerator': <gavo.base.complexattrs.StructAttribute object>, 'id': <gavo.base.parsecontext.IdAttribute object>, 'inputKey': <gavo.rscdef.common.ColumnListAttribute object>, 'inputKeys': <gavo.rscdef.common.ColumnListAttribute object>, 'inputTable': <gavo.base.complexattrs.StructAttribute object>, 'metaMaker': <gavo.base.complexattrs.StructListAttribute object>, 'metaMakers': <gavo.base.complexattrs.StructListAttribute object>, 'original': <gavo.base.parsecontext.OriginalAttribute object>, 'outputTable': <gavo.base.complexattrs.StructAttribute object>, 'properties': <gavo.base.complexattrs.PropertyAttribute object>, 'property': <gavo.base.complexattrs.PropertyAttribute object>, 'rd': <gavo.rscdef.common.RDAttribute object>}¶
- property rd¶
- rejectExtras = True¶
- setProperty(name, value)¶
- class gavo.protocols.datalink.DatalinkDescriptorMixin[source]¶
Bases:
object
some generally useful attributes that various code expects datalink descriptors to have.
These are the makeLink/makeLinkFromFile methods, but also data (where SODA processors accumulate the data they will serve), forSemantics (the semantics we are trying to produce) and contentQualifier (the sort of data at the other end; only touch this if you expect your link to be sent through SAMP).
- cleanup()[source]¶
this method is called at the end of a dlget run.
Use it to, for instance, close any files you still have open. By default, it does nothing.
- contentQualifier = None¶
- currentSemantics(sem)[source]¶
sets the default semantics for links and faults generated in the controlled block to sem.
- data = None¶
- forSemantics = 'http://dc.g-vo.org/datalink#other'¶
- makeLink(url, **kwargs)[source]¶
returns a LinkDef for this descriptor for url.
kwargs are passed on to LinkDef and include, in particular, semantics, contentType, contentLength, description, localSemantics, and contentQualifier.
- makeLinkFromFile(localPath, description, semantics=None, service=None, contentType=None, suppressMissing=False, localSemantics=None, contentQualifier=None)[source]¶
returns a LinkDef for a local file.
Arguments are as for LinkDef.fromFile, except you don’t have to pass in service if you’re using the datalink service itself to access the file; this method will try to find the service by itself.
- class gavo.protocols.datalink.DescriptorGenerator(parent, **kwargs)[source]¶
Bases:
ProcApp
A procedure application for making product descriptors for PUBDIDs
Despite the name, a descriptor generator has to return (not yield) a descriptor instance. While this could be anything, it is recommended to derive custom classes from prodocols.datalink.ProductDescrpitor, which exposes essentially the columns from DaCHS’ product table as attributes. This is what you get when you don’t define a descriptor generator in your datalink core.
Before writing your own, see if one of the predefined descriptor generators work for you; see `Descriptor Generators`_ below.
The following names are available to the code:
pubDID – the pubDID to be resolved
- args – all the arguments that came in from the web
(these should not usually be necessary for making the descriptor and are completely unparsed at this point)
FITSProductDescriptor – the base class of FITS product descriptors
- DLFITSProductDescriptor – the same, just for when the product table
has a datalink.
ProductDescriptor – a base class for your own custom descriptors
DatalinkFault – use this when flagging failures
soda – contents of the soda module for convenience
If you made your pubDID using the
getStandardPubDID
rowmaker function, and you need no additional logic within the descriptor, the default (//soda#fromStandardPubDID) should do.If you need to derive custom descriptor classes, you can see the base class under the name ProductDescriptor; there’s also FITSProductDescriptor and DatalinkFault in each proc’s namespace. If your Descriptor does not actually refer to something in the product table, it is likely that you want to set the descriptor’s
suppressAutoLinks
attribute to True. This will stop DaCHS from attempting to add automatic #this and #preview links.- additionalNamesForProcs = {'DLFITSProductDescriptor': <class 'gavo.protocols.datalink.DLFITSProductDescriptor'>, 'DatalinkFault': <class 'gavo.protocols.soda.DatalinkFault'>, 'FITSProductDescriptor': <class 'gavo.protocols.datalink.FITSProductDescriptor'>, 'ProductDescriptor': <class 'gavo.protocols.datalink.ProductDescriptor'>, 'getFITSDescriptor': <function getFITSDescriptor>, 'soda': <module 'gavo.protocols.soda' from '/home/msdemlei/gavo/trunk/gavo/protocols/soda.py'>}¶
- attrSeq = [<gavo.base.complexattrs.StructListAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.parsecontext.IdAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.parsecontext.OriginalAttribute object>, <gavo.base.parsecontext.ReferenceAttribute object>, <gavo.base.complexattrs.StructListAttribute object>, <gavo.base.attrdef.EnumeratedUnicodeAttribute object>]¶
- completedCallbacks = []¶
- formalArgs = 'pubDID, args'¶
- managedAttrs = {'bind': <gavo.base.complexattrs.StructListAttribute object>, 'bindings': <gavo.base.complexattrs.StructListAttribute object>, 'code': <gavo.base.attrdef.UnicodeAttribute object>, 'deprecated': <gavo.base.attrdef.UnicodeAttribute object>, 'doc': <gavo.base.attrdef.UnicodeAttribute object>, 'id': <gavo.base.parsecontext.IdAttribute object>, 'name': <gavo.base.attrdef.UnicodeAttribute object>, 'original': <gavo.base.parsecontext.OriginalAttribute object>, 'procDef': <gavo.base.parsecontext.ReferenceAttribute object>, 'setup': <gavo.base.complexattrs.StructListAttribute object>, 'setups': <gavo.base.complexattrs.StructListAttribute object>, 'type': <gavo.base.attrdef.EnumeratedUnicodeAttribute object>}¶
- name_ = 'descriptorGenerator'¶
- requiredType = 'descriptorGenerator'¶
- class gavo.protocols.datalink.FITSProductDescriptor(*args, **kwargs)[source]¶
Bases:
ProductDescriptor
A SODA descriptor for FITS files.
On top of the normal product descriptor, this has an attribute hdr containing a copy of the image header, and a method changingAxis (see there).
There’s also an attribute dataIsPristine that must be set to false if changes have been made. The formatter will spit out the original data otherwise, ignoring your changes.
Finally, there’s a slices attribute provided explained in soda#fits_doWCSCutout that can be used by data functions running before it to do cutouts.
Append any files you have open during dlget processing to self.toClose. The cleanup method makes sure they are closed before continuing.
The FITSProductDescriptor is constructed like a normal ProductDescriptor.
- changingAxis(axisIndex, parName)[source]¶
must be called before cutting out along axisIndex.
axIndex is a FITS (1-based) axis index axIndex, parName the name of the parameter that causes the cutout.
This will simply return if nobody has called changingAxis with that index before and raise a ValidationError otherwise. Data functions doing a cutout must call this before doing so; if they don’t the cutout will probably be wrong when two conflicting constraints are given.
- class gavo.protocols.datalink.LinkDef(pubDID, accessURL, serviceType=None, errorMessage=None, description=None, semantics='http://dc.g-vo.org/datalink#other', contentType=None, contentLength=None, localSemantics=None, contentQualifier=None)[source]¶
Bases:
object
a definition of a datalink related document.
These are constructed at least with:
the pubDID (as a string)
the access URL (as a string)
In addition, we accept the remaining column names from `//datalink#dlresponse`_ as keyword arguments, except we use camel case here, i.e.,
description
,semantics
,contentType
,contentLength
,localSemantics
.You usually do not want to construct LinkDefs directly. Use the makeLink or makeLinkFromFile methods on descriptors instead. Also, define semantics via the attribute on `element metaMaker`_ whenever you can; that will improve error messages.
- asDict()[source]¶
returns the link definition in a form suitable for ingestion in //datalink#dlresponse.
- classmethod fromFile(localPath, description, semantics, service, contentType=None, localSemantics=None, contentQualifier=None, suppressMissing=False)[source]¶
constructs a LinkDef based on a local file.
You must give localPath (which may be resdir-relative), description and semantics are mandatory. ContentType and contentSize will normally be determined by DaCHS.
You must also pass in the service used to retrieve the file. This must allow the static renderer and have a staticData property. It should normally be the datalink service itself, which in a metaMaker is accessible as self.parent.parent. It is, however, legal to reference other suitable services (use self.parent.rd.getById or base.resolveCrossId)
If you pass suppressMissing=True, a link to a non-existing file will be skipped rather than create a missing datalink.
- class gavo.protocols.datalink.MetaMaker(parent, **kwargs)[source]¶
Bases:
ProcApp
A procedure application that generates metadata for datalink services.
The code must be generators (i.e., use yield statements) producing either svcs.InputKeys or protocols.datalink.LinkDef instances.
metaMaker see the data descriptor of the input data under the name descriptor.
The data attribute of the descriptor is always None for metaMakers, so you cannot use anything given there.
Within MetaMakers’ code, you can access InputKey, Values, Option, and LinkDef without qualification, and there’s the MS function to build structures. Hence, a metaMaker returning an InputKey could look like this:
<metaMaker> <code> yield MS(InputKey, name="format", type="text", description="Output format desired", values=MS(Values, options=[MS(Option, content_=descriptor.mime), MS(Option, content_="text/plain")])) </code> </metaMaker>
(of course, you should give more metadata – ucds, better description, etc) in production).
Note that InputKey-returning MetaMakers cannot rely on descriptor.pubDID to actually have a value; in particular SSA may construct cores to produce “direct” processing datalink descriptors. When you need a pubDID, just return if descriptor.pubDID is None.
Alternatively, yield link definitions, i.e., rows for the links response. You will usually define a semantics attribute for the meta maker then (this lets DaCHS use the right semantics in case something goes wrong), and you will usually create links from the descriptor so the pubDID will be right automatically:
<metaMaker semantics="#flat"> <code> yield descriptor.makeLink( "http://example.org/flats/master-flat.fits", contentType="image/fits", description="The master flat for this epoch", contentLength=2048x2048*2) </code> </metaMaker>
It’s ok to yield None; this will suppress a Datalink and is convenient when some component further down figures out that a link doesn’t exist (e.g., because a file isn’t there). Note that in many cases, it’s more helpful to client components to handle such situations by yielding a DatalinkFault.NotFoundFault.
In addition to the usual names available to ProcApps, meta makers have:
MS – function to make DaCHS structures
InputKey – the class to make for input parameters
Values – the class to make for input parameters’ values attributes
Options – used by Values
LinkDef – a class to define further links within datalink services.
ProcLinkDef – a class to reference dlget services outside of the current service
DatalinkFault – a container of datalink error generators
soda – the soda module.
- additionalNamesForProcs = {'DatalinkFault': <class 'gavo.protocols.soda.DatalinkFault'>, 'InputKey': <class 'gavo.svcs.inputdef.InputKey'>, 'LinkDef': <class 'gavo.protocols.datalink.LinkDef'>, 'MS': <function makeStruct>, 'Option': <class 'gavo.rscdef.column.Option'>, 'ProcLinkDef': <class 'gavo.protocols.datalink.ProcLinkDef'>, 'Values': <class 'gavo.rscdef.column.Values'>, 'soda': <module 'gavo.protocols.soda' from '/home/msdemlei/gavo/trunk/gavo/protocols/soda.py'>}¶
- attrSeq = [<gavo.base.complexattrs.StructListAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.parsecontext.IdAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.parsecontext.OriginalAttribute object>, <gavo.base.parsecontext.ReferenceAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.complexattrs.StructListAttribute object>, <gavo.base.attrdef.EnumeratedUnicodeAttribute object>]¶
- completedCallbacks = []¶
- formalArgs = 'self, descriptor'¶
- managedAttrs = {'bind': <gavo.base.complexattrs.StructListAttribute object>, 'bindings': <gavo.base.complexattrs.StructListAttribute object>, 'code': <gavo.base.attrdef.UnicodeAttribute object>, 'deprecated': <gavo.base.attrdef.UnicodeAttribute object>, 'doc': <gavo.base.attrdef.UnicodeAttribute object>, 'id': <gavo.base.parsecontext.IdAttribute object>, 'name': <gavo.base.attrdef.UnicodeAttribute object>, 'original': <gavo.base.parsecontext.OriginalAttribute object>, 'procDef': <gavo.base.parsecontext.ReferenceAttribute object>, 'semantics': <gavo.base.attrdef.UnicodeAttribute object>, 'setup': <gavo.base.complexattrs.StructListAttribute object>, 'setups': <gavo.base.complexattrs.StructListAttribute object>, 'type': <gavo.base.attrdef.EnumeratedUnicodeAttribute object>}¶
- name_ = 'metaMaker'¶
- requiredType = 'metaMaker'¶
- class gavo.protocols.datalink.ProcLinkDef(pubDID, dlSvc)[source]¶
Bases:
object
a definition of a datalink processing service other than self’s dlget.
Whenever you datalink service allows a dlget, a descriptor for that will be generated based on the keys returned by the metamaker. Sometimes, you want to provide a second processing service within a single datalink document. In that case, yield a ProcLinkDef objects constructed with a dlget-allowing datalink service in its second argument. As usual for LinkDefs, the first argument must be the DID for which to generate the service.
The description of this link will be the description of that service.
- class gavo.protocols.datalink.ProductDescriptor(pubDID, accref, accessPath, mime, owner=None, embargo=None, sourceTable=None, datalink=None, preview=None, preview_mime=None)[source]¶
Bases:
DatalinkDescriptorMixin
An encapsulation of information about some “product” (i.e., file).
This is basically equivalent to a line in the product table; the arguments of the constructor are all available as same-named attributes.
It also has an attribute data defaulting to None. DataGenerators set it, DataFilters potentially change it.
There is also a method cleanup() that is called at the end of dlget processing; the default implementation does nothing, so there is no need to up-call when you override it from here.
If you inherit from this class and you have a way to guess the size of what the descriptor describes, override the estimateSize() method. The default will return a file size if accessPath points to an existing file, None otherwise.
- gavo.protocols.datalink.getFITSDescriptor(pubDID, accrefPrefix=None, cls=<class 'gavo.protocols.datalink.FITSProductDescriptor'>, qnd=False)[source]¶
returns a datalink descriptor for a FITS file.
This is the implementation of fits_genDesc and should probably reused when making more specialised descriptors.
- gavo.protocols.datalink.makeDatalinkServiceDescriptor(ctx, service, tableDef, columnName)[source]¶
returns a datalink descriptor for a datalink (dlmeta) service).
What’s returned is gavo.votable elements.
ctx is a votablewrite VOTableContext that manages the IDs of the elements involved, service is the datalink service as a svc.Service instance, tableDef is the rscdef.TableDef instance with the rows the datalink service operates on, and columnName names the column within table to take the datalink’s ID parameter from.