DCI Utilities

raw JSON →
0.0.1148 verified Sat May 09 auth: no python

A set of Python utilities for DCI (Distributed CI) jobs. Version 0.0.1148 is the latest; releases are frequent (hundreds of minor increments).

pip install dci-utils
error ModuleNotFoundError: No module named 'dciutils'
cause Importing with the wrong module name (dciutils vs dci_utils).
fix
Use 'import dci_utils' (with underscore).
error TypeError: 'str' object is not callable
cause Using 'from dci_utils import *' which may overwrite built-in names (e.g., 'id', 'type').
fix
Avoid 'from dci_utils import *'; instead import specific functions.
error dci_utils.exceptions.DCIUtilsError: Failed to authenticate
cause Missing or incorrect DCI_LOGIN or DCI_PASSWORD environment variables.
fix
Ensure DCI_LOGIN and DCI_PASSWORD are set correctly, e.g., os.environ['DCI_LOGIN'] = 'myuser'.
breaking v0.0.1000+ dropped support for Python 2.7. All users must migrate to Python 3.6+.
fix Use Python 3.6+ and run 'pip install --upgrade dci-utils'.
gotcha The top-level module is 'dci_utils' (with underscore), not 'dciutils' (no underscore). Many examples mistakenly use the wrong hyphenated form.
fix Use 'from dci_utils import ...' – note the underscore.
deprecated The function 'get_job_files()' is deprecated in v0.0.1100+ and will be removed. Use 'list_job_files()' instead.
fix Replace calls to get_job_files() with list_job_files().
gotcha Environment variables DCI_LOGIN and DCI_PASSWORD are required for API calls. If not set, the library fails silently with a cryptic error.
fix Set DCI_LOGIN and DCI_PASSWORD before using any remote function.

Fetch job info using the DCI remote API.

from dci_utils import get_job_info
from dci_utils import DCIUtilsError
import os

# Set environment variables or use defaults
os.environ['DCI_LOGIN'] = os.environ.get('DCI_LOGIN', 'admin')
os.environ['DCI_PASSWORD'] = os.environ.get('DCI_PASSWORD', '')

try:
    info = get_job_info(job_id='12345')
    print(info)
except DCIUtilsError as e:
    print(f'Error: {e}')