Skip to main content

Python library for using the UNICORE REST API

Project description

# Python library for using the UNICORE REST API

This library covers part of the UNICORE REST API, making common tasks like file access, job submission and management, workflow submission and management more convenient, and integrating UNICORE features better with typical Python usage.

For the full, up-to-date documentation of the REST API, see https://sourceforge.net/p/unicore/wiki/REST_API

Development of this library was funded in part by the Human Brain Project

For more information about the Human Brain Project, see https://www.humanbrainproject.eu/

See LICENSE file for licensing information

# Getting started with pyUNICORE

Install from PyPI with

pip install -U pyunicore

Sample code to create a client for a UNICORE site

import pyunicore.client as unicore_client import json from base64 import b64encode

base_url = “https://localhost:8080/DEMO-SITE/rest/core

# authenticate with username/password token = b64encode(b”demouser:test123”).decode(“ascii”) transport = unicore_client.Transport(token, oidc=False)

client = unicore_client.Client(transport, base_url) print(json.dumps(client.properties, indent = 2))

# Running a sample job and reading result data

my_job = {‘Executable’: ‘date’}

job = client.new_job(job_description=my_job, inputs=[]) print(json.dumps(job.properties, indent = 2))

job.poll() # wait for job to finish

work_dir = job.working_dir print(json.dumps(work_dir.properties, indent = 2))

stdout = work_dir.stat(“/stdout”) print(json.dumps(stdout.properties, indent = 2))

content = stdout.raw().read() print(content)

# Connecting to a Registry and listing all registered services

import pyunicore.client as unicore_client import json, b64encode

registry_url = “https://localhosz:8080/REGISTRY/rest/registries/default_registry

# authenticate with username/password token = b64encode(b”demouser:test123”).decode(“ascii”) transport = unicore_client.Transport(token, oidc=False)

r = unicore_client.Registry(tr, registry_url) print(r.site_urls)

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

pyunicore-0.9.16.tar.gz (32.6 kB view details)

Uploaded Source

File details

Details for the file pyunicore-0.9.16.tar.gz.

File metadata

  • Download URL: pyunicore-0.9.16.tar.gz
  • Upload date:
  • Size: 32.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for pyunicore-0.9.16.tar.gz
Algorithm Hash digest
SHA256 52263cf956bd847df7c061a928e3e6408a5c94f642bd1c92db0c94589f9b8f80
MD5 02c418e0236b5573c01a234c255d5a19
BLAKE2b-256 86dff2c46fe25f5f15118d00ab520fed94d2df5c598fb3b584c2841df525fb28

See more details on using hashes here.

Supported by

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