Skip to main content

Python library for interacting with a Yandex DataProc Queue

Project description

EtuDataProc

PyPI Python 3.6, 3.7, 3.8 GitHub Pull Requests License

EtuDataProc is a Python library designed to simplify interaction with a queue service API. It provides methods for authentication, sending codes to the queue, retrieving results, checking queue positions, and canceling tasks. This README serves as a guide to using the QueueClient library effectively.

Installation

Install the current version with PyPI:

pip install etudataproc

Or from Github:

pip install https://github.com/sesh00/etudataproc/archive/main.zip

Usage

Importing the QueueClient

To use QueueClient in your Python code, import it as follows:

from etudataproc import QueueClient

Initializing the QueueClient

You can initialize a QueueClient object by providing the base URL of the queue service and optionally the authentication token.

queue_client = QueueClient(base_url="https://your-queue-service-url.com", token="your-auth-token")

Authentication

You can authenticate with the queue service using your username and password.

queue_client.authenticate(username="your-username", password="your-password")

Sending Code to the Queue

To send a code to the queue, use the send_code() method.

code = "your-code-to-be-sent"
queue_client.send_code(code)

Retrieving Result

To retrieve the result of a task from the queue, use the get_result() method.

result = queue_client.get_result()

Checking Queue Position

You can check your position in the queue using the get_queue_position() method.

position = queue_client.get_queue_position()

Canceling Task

To cancel a task in the queue, use the cancel_task() method. queue_client.cancel_task()

queue_client.cancel_task()

Error Handling

If authentication or token-related errors occur, QueueClient raises an Exception with an appropriate error message. Ensure to handle these exceptions appropriately in your code.

Example

Here's a simple example demonstrating the usage of QueueClient:

from etudataproc import QueueClient

queue_client = QueueClient(base_url="https://your-queue-service-url.com")
queue_client.authenticate(username="your-username", password="your-password")

code = "your-code-to-be-sent"
queue_client.send_code(code)

result = queue_client.get_result()
print("Task Result:", result)

position = queue_client.get_queue_position()
print("Queue Position:", position)

queue_client.cancel_task()

Contributing

Contributions to EtuDataProc are welcome! If you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request on the GitHub repository.

License

The module is available as open source under the terms of the MIT License

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

etudataproc-0.1.2.tar.gz (4.1 kB view details)

Uploaded Source

File details

Details for the file etudataproc-0.1.2.tar.gz.

File metadata

  • Download URL: etudataproc-0.1.2.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.0

File hashes

Hashes for etudataproc-0.1.2.tar.gz
Algorithm Hash digest
SHA256 54ecf85606796357c2a3da9efc8a488366f2cd4e380275f86d93b4695f23cb21
MD5 5c17c207c608c918cb1f76e39fa45b6e
BLAKE2b-256 2eb64537d2cee951b3a450ad0fcf44b399e35ee757fe761d91602bbe00c0172e

See more details on using hashes here.

Supported by

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