Skip to main content

rda_python_metrics

RDA Python package to gather and view data usage metrics for the NSF NCAR Geoscience Data Exchange (GDEX).

Programs

The package provides two categories of programs:

Run as gdexdata via setuid (requires setup below):

Command Connector script Description
logarch setuid_logarch Archive RDA log files (web, TDS, AWS, OSDF, dssdb) to the DECSDATA area

Run as current user (no setuid required):

Command Description
fillawsusage Fill AWS usage metrics into the database
fillcdgusage Fill CDG usage metrics into the database
fillcodusage Fill COD usage metrics into the database
fillcountry Fill country information into the database
fillendtime Fill end times for usage records
fillgdexusage Fill GDEX usage metrics into the database
fillglobususage Fill Globus transfer usage metrics into the database
fillipinfo Fill IP geolocation info into the database
filloneorder Fill metrics for a single order
fillosdfusage Fill OSDF usage metrics into the database
fillrdadb Fill RDA database usage metrics
filltdsusage Fill TDS (THREDDS) usage metrics into the database
filluser Fill user information into the database
fillzenodousage Fill Zenodo usage metrics into the database
pgperson Retrieve user info from the UCAR People API by field
pgusername Retrieve user info from the UCAR People API by username
viewallusage View combined usage statistics
viewawsusage View AWS usage statistics
viewcheckusage View usage check results
viewcodusage View COD usage statistics
viewordusage View order usage statistics
viewosdfusage View OSDF usage statistics
viewrqstusage View request usage statistics
viewtdsusage View TDS usage statistics
viewwebfile View web file access records
viewwebusage View web usage statistics

Environment setup

Create a Python environment first; package installs in the next section run inside whichever environment you activate here.

Option A — Python venv (DECS machines)

python3 -m venv $ENVHOME          # e.g. /glade/u/home/gdexdata/gdexmsenv
source $ENVHOME/bin/activate

Option B — Conda (DAV/Casper)

conda create --prefix $ENVHOME python=3.12   # e.g. /glade/work/gdexdata/conda-envs/pg-gdex
conda activate $ENVHOME

Installing rda-python-metrics

Pick whichever install mode fits your workflow. All four pull in the transitive dependencies (rda_python_common, rda_python_setuid, geoip2, ipinfo, httplib2, dnspython, unidecode, urllib3>=2.5.0, requests>=2.33.0, idna>=3.10) automatically.

For local development, clone this repo alongside your project and install it in editable mode so that changes are picked up without re-installing:

git clone https://github.com/NCAR/rda-python-metrics.git
cd rda-python-metrics
pip install -e .

To test a specific branch (e.g. an in-progress feature or fix branch), pass -b/--branch to git clone:

git clone -b <branch-name> https://github.com/NCAR/rda-python-metrics.git
cd rda-python-metrics
pip install -e .

For a regular (non-editable) install from a checkout:

pip install /path/to/rda-python-metrics

For a production install on a system that uses the published distribution:

pip install rda_python_metrics

Setuid Setup

logarch runs as the common user PGLOG['COMMONUSER'] (default gdexdata) via the rda_python_setuid mechanism, which is pulled in automatically as a dependency. After pip install above, choose one of the wiring options below.

Note: If rda_python_setuid is already installed and fully set up in your environment, you can skip the compile step (-c/--compile) and the optional pgstart step (-p/--pgstart). The -l/--link step is still required to wire up this package's own setuid program.

Full setuid install (requires sudo access to COMMONUSER)

Run these steps once per environment:

# 1. Compile the pywrapper C binary (once per environment):
pywrapper-install -c|--compile -n|--username gdexdata

# 2. Wire up logarch as a setuid entry (or use 'all' to link every setuid_* at once):
pywrapper-install -l|--link logarch
pywrapper-install -l|--link all

# 3. Optionally, install a pgstart_<loginname> binary so <loginname> (any
#    user in the same group as PGLOG['COMMONUSER']) can run commands as
#    themselves.  Run either by PGLOG['ADMINUSER'] (default zji, if it has
#    'sudo -u <loginname>'), or by <loginname> directly:
pywrapper-install -p|--pgstart -n|--username <loginname>

pywrapper-install with no arguments displays the full user guide.

Simple install (no sudo required, runs as current user)

Users who do not need the setuid mechanism can create a direct symlink instead:

pywrapper-install -l|--link logarch -s|--simple
pywrapper-install -l|--link all -s|--simple   # or link every setuid_* at once

This creates bin/logarch -> bin/setuid_logarch and logarch runs as the current user with no privilege change.

Update an existing installation (no sudo required)

When the package is upgraded and a new pywrapper.c is bundled, recompile and reinstall all setuid binaries using the existing pgstart_* binaries:

pywrapper-install -u|--update

Setup guide

The shared setuid setup guide is shown automatically if setuid_logarch is invoked directly before the setuid wrapper has been configured.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rda_python_metrics-3.0.4.tar.gz (124.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rda_python_metrics-3.0.4-py3-none-any.whl (242.2 kB view details)

Uploaded Python 3

File details

Details for the file rda_python_metrics-3.0.4.tar.gz.

File metadata

  • Download URL: rda_python_metrics-3.0.4.tar.gz
  • Upload date:
  • Size: 124.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for rda_python_metrics-3.0.4.tar.gz
Algorithm Hash digest
SHA256 e3b04eff1b3273502e961a0ebe0eac97e7b8ab96060c537553d19d9d07e2e10b
MD5 15204a116d35027dc7e08167cd92d0ff
BLAKE2b-256 6b4d52fb291dd10ec4f9d7f890113e1abbcd8c6a300bef54b8b828afe90bc162

See more details on using hashes here.

Provenance

The following attestation bundles were made for rda_python_metrics-3.0.4.tar.gz:

Publisher: publish.yml on NCAR/rda-python-metrics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rda_python_metrics-3.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for rda_python_metrics-3.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5d13b2ffff8fb123ccd1e2b0b2ceea56d1ab0d449d51a2292d69906f51ef6400
MD5 3b3a24443e5c23aa080edb023de1c152
BLAKE2b-256 d6c91648771e6e40a97baf96b7e7ffb3d4a50302b2989a6b8d7d8290f5a262d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for rda_python_metrics-3.0.4-py3-none-any.whl:

Publisher: publish.yml on NCAR/rda-python-metrics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

3.0.5

2 files

This release

3.0.4 This release

2 files

3.0.3

2 files

3.0.2

2 files

2.0.6

2 files

2.0.5

2 files

2.0.4

2 files

2.0.3

2 files

2.0.2

2 files

2.0.1

2 files

2.0.0

2 files

1.0.51

2 files

1.0.50

2 files

1.0.49

2 files

1.0.48

2 files

1.0.47

2 files

1.0.46

2 files

1.0.45

2 files

1.0.44

2 files

1.0.43

2 files

1.0.42

2 files

1.0.41

2 files

1.0.40

2 files

1.0.39

2 files

1.0.38

2 files

1.0.37

2 files

1.0.36

2 files

1.0.35

2 files

1.0.34

2 files

1.0.33

2 files

1.0.32

2 files

1.0.31

2 files

1.0.30

2 files

1.0.28

2 files

1.0.27

2 files

1.0.26

2 files

1.0.25

2 files

1.0.24

2 files

1.0.23

2 files

1.0.22

2 files

1.0.21

2 files

1.0.20

2 files

1.0.18

2 files

1.0.17

2 files

1.0.16

2 files

1.0.15

2 files

1.0.14

2 files

1.0.12

2 files

1.0.11

2 files

1.0.10

2 files

1.0.9

2 files

1.0.8

2 files

1.0.7

2 files

1.0.6

2 files

1.0.5

2 files

1.0.4

2 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