Skip to main content

Library use to construct VGrain to democrite servers

Project description

Democrite

This library permit to create VGrain for using en Democrite environment.

Installation

pip install democrite

How to use

Your grain could be used in two mode :

  • OneShot: Script mode, the script is execute at each request
  • Deamon: The script is start and stay alive to perform request

Create VGrain

To start you need to create a vgrain object with command line argument pass in parameters

import democrite

app = democrite.vgrain(sys.argv)

Create function

You need to pass a function to execute each request

def execFunc(command: democrite.vgrainCommand, tools: democrite.vgrainTools) -> any:

Choose Mode

OneShot

The command data are pass in command line argument in format (Json -> Base64)
The command result is returned by the strandard output in format 'ExecutionId:(json -> Base64)'

app.execute(execFunc);

Deamon

A connection is made in local using the port pass in argument '--port:4242'

app.run(execFunc);

test

During you developement you need to test your code.
To do so use the test method with data you need as input.

app.test("5+6", execFunc);

vgrainCommand

The command is pass on an object exposing :

# uid unique of the flow executing the grain
vgrainCommand.get_flow_uid() -> uuid

# uid grain execution
vgrainCommand.get_execution_uid() -> uuid

# get command input
vgrainCommand.get_content() -> uuid

vgrainTools

This object provide tools dedicated to request

# provide access to a logger that will send back the logs to democrite
vgrainTools.get_logger.logInformation("LOG")

# provide the remain argument not consumed by the library
vgrainTools.get_args() -> list[str]

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

democrite-4.3.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

democrite-4.3.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file democrite-4.3.0.tar.gz.

File metadata

  • Download URL: democrite-4.3.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for democrite-4.3.0.tar.gz
Algorithm Hash digest
SHA256 fed5f4b1e2c261662943ce2e567b5fe025edf2650e44e841167c700589c08059
MD5 74f5ceddace97273f5e9b1f43f9ad044
BLAKE2b-256 c87eaabe909bb7f00bc93c72e1b5a63d7a35f28fb23e51074a0530a65db71941

See more details on using hashes here.

File details

Details for the file democrite-4.3.0-py3-none-any.whl.

File metadata

  • Download URL: democrite-4.3.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for democrite-4.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ae2f075a911edf3460f4fb9a3d8a772a65319305ab125a26ddc610d33bca334e
MD5 20de6eed358cdb2fc6df47d9473d8819
BLAKE2b-256 15ab7b6df868645df3141c20b14d470f8bf160135513b29b3aeaa9bc887cd4f1

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