gavo.svcs.core module

Cores are the standard object for computing things in the DC.

This module also contains the registry for cores. If you want to be able to refer to cores from within an RD, you need to enter your core here.

Cores return pairs of a type and a payload. Renderers should normally be prepared to receive (None, OutputTable) and (mime/str, data/str), though individual cores might return other stuff (and then only work with select renderers).

In general, the input table definition is mandatory, i.e., you have to come up with it. Services do this either ad-hoc from input from the web or using an inputDD.

The output table, on the other hand, is “advisory”, mainly for registry and documentation purposes (“I could return this”). In particular DBBasedCores will usually adapt to the service’s wishes when it comes to the output table structure, not to mention the ADQL core. This doesn’t hurt since whatever is returned comes with structure documentation of its own.

Cores may also want to adapt to renderers. This is a bit of a hack to support, e.g., form and scs within a single service, which avoids two different VOResource records just because of slightly differning input definitions.

The interface here is the adaptForRenderer method. It takes a single argument, the renderer, either as a simple name resolvable in the renderer registry, or as a renderer instance or class. It must return a new core instance.

Currently, two mechanisms for core adaptation are in place:

(1) generically, inputKeys can have properties onlyForRenderer and notForRenderer with the obvious semantics.

(2) cores that have condDescs may adapt by virtue of condDesc’s adaptForRenderer method.

class gavo.svcs.core.Core(parent, **kwargs)[source]

Bases: Structure

A definition of the “active” part of a service.

A core will receive input from a renderer in the form of a svcs.CoreArgs (see `Core Args`_). A core will return a table or perhaps directly data as discussed in `DaCHS' Service Interface`_ .

The abstract core element will never occur in resource descriptors. See `Cores Available`_ for concrete cores. Use the names of the concrete cores in RDs.

adaptForRenderer(renderer, queryMeta)[source]

returns a core object tailored for renderer.

attrSeq = [<gavo.base.parsecontext.IdAttribute object>, <gavo.base.complexattrs.StructAttribute object>, <gavo.base.parsecontext.OriginalAttribute object>, <gavo.base.complexattrs.StructAttribute object>, <gavo.base.complexattrs.PropertyAttribute object>, <gavo.rscdef.common.RDAttribute object>]
clearProperty(name)
completeElement(ctx)[source]
completedCallbacks = []
getFullId()
getProperty(name, default=<Undefined>)
getRelevantTables()[source]

returns a sequence of “published tables”.

This is for VOSI tables, and hence what’s a “published table” is a bit fuzzy. By default we return the output table if it looks non-trivial, or else nothing at all.

hasProperty(name)
initialize()[source]

override to configure the custom core before use.

This is typically where you pull input or output tables from the RD in customCores. Actual DaCHS code should use completeElement as usual.

inputTableXML = None
makeUserDoc()[source]
managedAttrs = {'id': <gavo.base.parsecontext.IdAttribute object>, 'inputTable': <gavo.base.complexattrs.StructAttribute 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_ = 'core'
outputTableXML = None
property rd
run(service, inputData, queryMeta)[source]
setProperty(name, value)
class gavo.svcs.core.DebugCore(parent, **kwargs)[source]

Bases: Core

a core that returns its arguments stringified in a table.

You need to provide an external input tables for these.

attrSeq = [<gavo.base.parsecontext.IdAttribute object>, <gavo.base.complexattrs.StructAttribute object>, <gavo.base.parsecontext.OriginalAttribute object>, <gavo.base.complexattrs.StructAttribute object>, <gavo.base.complexattrs.PropertyAttribute object>, <gavo.rscdef.common.RDAttribute object>]
clearProperty(name)
completedCallbacks = []
getFullId()
getProperty(name, default=<Undefined>)
hasProperty(name)
managedAttrs = {'id': <gavo.base.parsecontext.IdAttribute object>, 'inputTable': <gavo.base.complexattrs.StructAttribute 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_ = 'debugCore'
outputTableXML = '\n\t\t<outputTable>\n\t\t\t<outputField name="arg_key" type="text"\n\t\t\t\tdescription="Name of an input parameter"/>\n\t\t\t<outputField name="arg_value" type="text"\n\t\t\t\tdescription="(First) value passed (or None)"/>\n\t\t</outputTable>'
property rd
run(service, inputTable, queryMeta)[source]
setProperty(name, value)
gavo.svcs.core.getCore(name)[source]