...
In this example, when the suffix hasn't been provided, the default suffix is used.
Custom Configuration
Pipelets can define a custom set of configuration properties, which can be exposed in the UI as a form (instead of a JSON input). This makes the configuration much more user friendly, and is the recommended way. To define its configuration, a pipelet should implement the getArguments() method.
The method is expected to return an array of objects defining each property. Inside each object, the fields name
, display_label
and type
are required. Optional field required
specifies whether the property is required to be filled by the user. Additionally, a property can be placed in an Advanced section of the configuration, by setting advanced
to true
on that property.
Code Block |
---|
from squirro.sdk import PipeletV1
class ModifyTitlePipelet(PipeletV1):
# def __init__, def consume
@staticmethod
def getArguments():
return [
{
'name': 'commands',
'display_label': 'Source code',
'type': 'code',
'syntax': 'sqscript',
'required': True,
},
{
'name': 'debug',
'display_label': 'Log debug output',
'type': 'bool',
'help': 'Logs debug output to the server log files',
'advanced': True,
},
] |
Documentation
A pipelet class can be documented using docstrings. The first sentence (separated by period) is used as a summary in the user interface. All the remaining text is used as a description and is often used to document the expected configuration. The description is parsed as Markdown (using the CommonMark dialect). The 60-second overview serves as a good reference.
...