Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To use this in a project, open the Enrichments tab in the Squirro user interface and press "Add Enrichment". In the resulting dialog, the pipelet can be selected in the drop-down menu.

Using additional files with Pipelets

In many cases, additional files like libraries and pre-trained models must be uploaded and used by a pipelet when it is run. 

To accomplish this, additional files can be uploaded and accessed by the pipelet by following these steps:

  1. Specify the additional files in the pipelet upload command. For Example:

    Code Block
    languagebash
    pipelet upload \
    --data-file 'resource.txt' \
    --cluster <cluster> \
    --token <your_token> \
    'pipelet.py' \
    'TestPipelet'

    In this example, we are uploading a file "resource.txt" along with the pipelet.

  2. Access the contents of the file(s) from within the pipelet

    Code Block
    languagepy
    from squirro.sdk import require, PipeletV1
    
    @require('files')
    class TestPipelet(PipeletV1):
    	
        def consume(self, item):
    
            with self.files.get_file('resource.txt') as f:
                data = f.read()

Processing old items

Pipelets are only run for items that are processed in the system after the enrichment has been configured. For information on how to process old items with a pipelet, see Rerunning a Pipelet.

...