Skip to main content

About Boa Python Client API

The Boa Python Client API provides programmatic access to the Boa language and infrastructure from Python.

About Boa

For more information about Boa, please see the main website: https://boa.cs.iastate.edu/

Creating a client

The main entry point for the API is a BoaClient object. You use this to log in, submit queries, find datasets, log out, etc. To instantiate this object, you must provide the API endpoint's URL. The API has several constants for common endpoints:

  • BOA_API_ENDPOINT - for the Boa MSR endpoint
  • BOAC_API_ENDPOINT - for the Boa CORD-19 endpoint

For example if you want a client for the CORD-19 endpoint, you do the following:

client = BoaClient(endpoint=BOAC_API_ENDPOINT)

If you don't specify an endpoint, it will default to the MSR endpoint.

Example Use (using MSR endpoint)

import getpass
import time

from boaapi.boa_client import BoaClient, BOA_API_ENDPOINT
from boaapi.status import CompilerStatus, ExecutionStatus

client = BoaClient(endpoint=BOA_API_ENDPOINT)
user = input("Username [%s]: " % getpass.getuser())
if not user:
    user = getpass.getuser()
client.login(user, getpass.getpass())
print('successfully logged in to Boa API')

query = """# Counting the 10 most used programming languages
p: Project = input;
counts: output top(10) of string weight int;

foreach (i: int; def(p.programming_languages[i]))
    counts << p.programming_languages[i] weight 1;"""

# query using a specific dataset
job = client.query(query, client.get_dataset('2019 October/GitHub'))
print('query submitted')

while job.is_running():
    job.refresh()
    print('job ' + str(job.id) + ' still running, waiting 10s...')
    time.sleep(10)

if job.compiler_status is CompilerStatus.ERROR:
    print('job ' + str(job.id) + ' had compile error')
elif job.exec_status is ExecutionStatus.ERROR:
    print('job ' + str(job.id) + ' had exec error')
else:
    try:
        print('output:')
        print(job.output())
    except:
        pass

client.close()
print('client closed')

Release files for boa-api 0.1.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for boa-api 0.1.14
File Size Uploaded
boa-api-0.1.14.tar.gz 11.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for boa-api 0.1.14
File Interpreter ABI Platform
boa_api-0.1.14-py3-none-any.whl Python 3 none any Details

Total release size: 27.5 kB

Release files / boa-api-0.1.14.tar.gz

Download URL boa-api-0.1.14.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1b7e69b30b43d1966cc321271a4925657c654220eecb85f6e2eadd6e9c1f751c
BLAKE2b-256 checksum
How to use checksums
356a9357f85fa91c32e9c7074ceb7bfcc414ea1108488e20d131e80066e39cac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.7

Release files / boa_api-0.1.14-py3-none-any.whl

Download URL boa_api-0.1.14-py3-none-any.whl
Size 16.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b131dbfbc6ed04045aaff56f0520bde7f199b4940b99c136427cad3c22864d67
BLAKE2b-256 checksum
How to use checksums
93595c12cf4ec766a59a0a823c80f13543bd4b65813cc4c7c6718be514ce6ec6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.7

Release history Release notifications | RSS feed

This release

0.1.14 This release

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page