Skip to main content

The ECiDA-python to make things easier

Project description

ECIDA

The EcidaModule package is a Python module designed to facilitate deployment and communication between components in a distributed system. This package provides various functionalities including Kafka message handling, environment variable checking, and directory management.

How to Use

  1. Importing the package

    To use the EcidaModule in your Python program, first, you will need to import the EcidaModule class from the package:

    from Ecida import EcidaModule
    
  2. Create an ECiDA Module

    Define a module with this signature

    def create_module() -> EcidaModule:
        M = EcidaModule("MODULE_NAME", "MODULE_VERSION")
        # ADD MODULE INPUTS/OUTPUTS HERE
        ...
    return M
    
  3. Add inputs and outputs

    Use the following syntax for adding input and output to module. You can add as many I/O as required.

    # ADD STREAMING INPUT WITH 
    M.add_input("INPUT_NAME", "string")
    # ADD STREAMING OUTPUT 
    M.add_output("OUTPUT_NAME", "string")
    # ADD INPUT DIRECTORY FOR FILE USE 
    M.add_input_directory("INPUT_DIRECTORY_NAME")
    # ADD OUTPUT DIRECTORY FOR FILE USE 
    M.add_output_directory("OUTPUT_DIRECTORY_NAME")
    # ADD INPUT DIRECTORY PRELOADING FROM GIT FOR FILE USE
    M.add_input_from_git("INPUT_DIRECTORY_NAME", "GIT_REPOSITORY", "DIRECTORY/PATH/IN/GIT")
    
  4. Entry Point

    Use the following boiler-plate as the entry-point to your code.

    if __name__ == "__main__":
        M = create_module()
        M.initialize()
        main(M)
    

    and for the main function use the following signature:

    def main(M: EcidaModule):    
        #YOUR LOGIC COMES HERE
    

Example python file

An example template for the modules.

from Ecida import EcidaModule

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)


def create_module() -> EcidaModule:
    M = EcidaModule("MODULE_NAME", "MODULE_VERSION")
    # ADD MODULE INPUTS/OUTPUTS HERE

    return M

def main(M: EcidaModule):    
    print(f"START MODULE {M.name}:{M.version}")
    # LOGIC COMES HERE
      


if __name__ == "__main__":
    M = create_module()
    M.initialize()
    main(M)

NOTES

A python file can contain no more than one one module, since the module creation happens through using create_module() function with exact same signature.

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

ecida-0.0.24.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

ecida-0.0.24-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file ecida-0.0.24.tar.gz.

File metadata

  • Download URL: ecida-0.0.24.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for ecida-0.0.24.tar.gz
Algorithm Hash digest
SHA256 fbc5da06cdaab68745b10d05c303c4f0dac4ba3bcf38211e1c38196a6d9466d0
MD5 325239d6b258f5a6229caad784ee4a9e
BLAKE2b-256 2b1d430ee20bd97421215aca258a4495075c6c3828ce8b7d50a697ad9b48cfe8

See more details on using hashes here.

File details

Details for the file ecida-0.0.24-py3-none-any.whl.

File metadata

  • Download URL: ecida-0.0.24-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for ecida-0.0.24-py3-none-any.whl
Algorithm Hash digest
SHA256 116d7c28ffabbe6dd06187e5aef2eea2a8e77dc98e5a2276be4e63e5053122b2
MD5 918e4ebb221ecda7163433b915ffb38f
BLAKE2b-256 c89e89c0d7186d655308f7989d30a1465651e52e83c765b29058c8b7d2f6a7b8

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