Skip to main content

Library to interact with qcentroid agent api

Project description

qcentroid-agent-cli

deploy to pypi Python PyPI

Client library to interact with qcentroid agent API.

Functions

Functions:

  • obtain status, and context
  • obtain input data
  • send output data
  • set status
  • send execution logs

Install

pip install qcentroid-agent-cli

Use

As external agent:

from qcentroid_agent_cli import QCentroidSolverClient
base_url="https://api.qcentroid.xyz"
api_key="1234-4567-8910"
solver_id="123"

def main():
    
    print("Hello QCentroid Agent!")
    solver = QCentroidSolverClient(base_url, api_key, solver_id)

    while True: # put some escape function
        agent = solver.obtainJob()

        if agent :
            execute_job(agent)

        # Wait for 1 minute before the next iteration
        time.sleep(60)
   

if __name__ == "__main__":
    main()

As agent:

from qcentroid_agent_cli import QCentroidAgentClient

base_url = "https://api.qcentroid.xyz"
# job-id from EXECUTION_ID env var
# token from QCENTROID_TOKEN env var

agent = QCentroidAgentClient(base_url)
data = None
try:
  agent.start()
  data = agent.obtainData()
  #TODO job with data  
  agent.sendData(data)
  agent.end()
except BaseException as be:
  agent.error(be)
#end

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

qcentroid_agent_cli-0.3.8.tar.gz (3.7 kB view hashes)

Uploaded Source

Built Distribution

qcentroid_agent_cli-0.3.8-py3-none-any.whl (4.8 kB view hashes)

Uploaded Python 3

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