Skip to main content

No project description provided

Project description

library.qpubsub

pubsub layer for NLP services

Usages

Configs

You need to configure these in your service:

{
    "PROJECT_ID": "...",
    "SUBSCRIPTION_NAME": "...",
    "TOPIC_NAME": "...",
    "MAX_MESSAGES": ...
}

Where: PROJECT_ID: qordoba project id e.g. qordoba-devel SUBSCRIPTION_NAME: a subscription to pull the messages from e.g. dev4.segment-delegator.gender-tone-pubsub.allLang TOPIC_NAME: where to publish the result messages e.g. dev4.segment-delegator.gender-tone-pubsub-latch.allLang MAX_MESSAGES: The maximum number of messages in the subscriber queue e.g. 100

Use PubSub only

Add this to the service application.py

    ps_connection = QPubSub(
        analyzer,
        white_lister=whitelister,
        category=category,
        verbose=VERBOSE,
        debug=DEBUG,
        ignore_html=IGNORE_HTML,
        sentence_token_limit=SENTENCE_TOKEN_LIMIT,
        ignore_inside_quotes=False
    )

    ps_connection.connect()

Use PubSub with REST

Add this to the service application.py

    rest_connection = QRest(
        analyzer,
        white_lister=whitelister,
        category=category,
        verbose=VERBOSE,
        debug=DEBUG,
        ignore_html=IGNORE_HTML,
        sentence_token_limit=SENTENCE_TOKEN_LIMIT,
        ignore_inside_quotes=False
    )
    ps_connection = QPubSub(
        analyzer,
        white_lister=whitelister,
        category=category,
        verbose=VERBOSE,
        debug=DEBUG,
        ignore_html=IGNORE_HTML,
        sentence_token_limit=SENTENCE_TOKEN_LIMIT,
        ignore_inside_quotes=False
    )

    ps_connection.connect_with_rest(rest_connection)

Service docker changes to compile google-cloud-pubsub

add the following lines before pip install -r requirements.txt command

    apk update && \
    apk add --virtual build-dependencies linux-headers build-base gcc && \

add the following lines after pip install -r requirements.txt command

    apk del build-dependencies && \
    rm -rf /var/cache/apk/* && \

License

This software is not licensed. If you do not work at Qordoba, you are not legally allowed to use it. Also, it's just helper functions that really won't help you. If something in it does look interesting, and you would like access, open an issue.

TODO

  • reduce compile time
  • add tests
  • handle errors, e.g. publish it to an error topic or return empty issues to the same topic.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qpubsub-0.1.0.tar.gz (4.4 kB view details)

Uploaded Source

File details

Details for the file qpubsub-0.1.0.tar.gz.

File metadata

  • Download URL: qpubsub-0.1.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.6

File hashes

Hashes for qpubsub-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8cd2293a3662f5f509a27bff73ea625fd7a29d1da246b2691d2ef87e816d44a1
MD5 e3de1fcb7129a6280d4bc81778265c44
BLAKE2b-256 8cd4c6f0c290502444153e4377dca43cd641b3dd1becebc953eab135d10ae6f1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page