Library to interact with qcentroid agent api
Project description
qcentroid-agent-cli
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)
exit = False
while not exit: # put some escape function
try:
job = solver.obtainJob()
if job :
try:
job.start()
input_data = job.obtainInputData()
output_data = {}
#TODO: add your code here to generate output_data
job.sendOutputData(output_data)
#TODO: job.sendExecutionLog(logs)
job.end()
except Exception as e:
# job execution has failed, notify the platform about the error
job.error(e)
else:
# Wait for 1 minute before the next iteration
time.sleep(60)
except requests.RequestException as e:
# parameters are incorrect, url, api-key or solver_id, or infrastructure
print(f"Request failed: {e}")
exit=True
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
job = QCentroidAgentClient(base_url)
data = None
try:
job.start()
data = job.obtainData()
#TODO job with data
job.sendData(data)
job.end()
except BaseException as be:
job.error(be)
#end
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qcentroid_agent_cli-0.3.10.tar.gz.
File metadata
- Download URL: qcentroid_agent_cli-0.3.10.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b302ce2d6807b49c9010bf522f87566bb44f50f14fe422b95fe783b5200f88fc
|
|
| MD5 |
bbd48d6ea46acff03388bc5653a80392
|
|
| BLAKE2b-256 |
b237acb7e9fd82e11934ee0154826ba514c860b55691d7972483e98af03fecff
|
File details
Details for the file qcentroid_agent_cli-0.3.10-py3-none-any.whl.
File metadata
- Download URL: qcentroid_agent_cli-0.3.10-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01b123df120bd536d98934b5f9ba2528d862ee246fe0fda3eeb65f3587702115
|
|
| MD5 |
bb304ea6f298ddda2f968206e1b97339
|
|
| BLAKE2b-256 |
e2794764956b1938ca2cf1bb9e8b4a9179cca5bb86de73e39792e132f8ddd198
|