Package: bdrc-util
BDRC-UTILOverviewBDRC UTIL is a python package containing modules for use by the Buddhist Digital Resource Center. It is offered to
the public under theMIT License. This document describes its contents and features.Although publicly available, BDRC does not support this project for use by others. We will not respond to
questions about its features and functionality.Developmentarchive-ops uses python packages fromarchive-ops/venvDeployment# be in project main dirpython-msetupbdist_wheel# testtwineupload--verbose-rtestpypidist/bdrc_util-x.MM.mm-py3-none-any.whl# prodtwineupload--verbosedist/bdrc_util-x.MM.mm-py3-none-any.whlInstallationpyPI.org bdrc-utilDebian requirementsYou need this (and its dependencies) for the pip
component mysqlclient to installsudo apt install default-libmysqlclient-devMacOS requirementsYou need this (and its dependencies) for the pip
component mysqlclient to installbrew install mysqlContentsPublicly available scriptsAs defined in setup.pylocatorsMaps a work and a destination parent to a specific directory using various BDRC mapping schemesmigrate worksScripts to migrate and log works into BDRC's 2021 Archival strategylog_dipLog creation and distribution of Distribution Information Packages (DIPs). DIP is
an OAIS term to describe a unit of publication.User Guideslog_dipThe commandlog_dipis intended for use by BDRC staff to instrument their publication activities.log_diptakes arguments from the shell and transfers them into a database table.Synopsislog_dip --help
usage: DipLog.py | -d DBAppSection:DbAppFile  DipLog.py 

Logs a number of different publication strategies

positional arguments:
  dip_source_path       Source path - string, (optional)
  dip_dest_path         Destination path (optional) - string

optional arguments:
  -h, --help            show this help message and exit
  -d DRSDBCONFIG, --drsDbConfig DRSDBCONFIG
                        specify section:configFileName
  -l {info,warning,error,debug,critical}, --log-level {info,warning,error,debug,critical}
                        choice values are from python logging module
  -a {DRS,IA,BUDA,DEEP_ARCHIVE,ARCHIVE}, --activity_type {DRS,IA,BUDA,DEEP_ARCHIVE,ARCHIVE}
                        Destination repository
  -w WORK_NAME, --work_name WORK_NAME
                        work being distributed
  -i DIP_ID, --dip_id DIP_ID
                        ID to update
  -r ACTIVITY_RETURN_CODE, --activity_return_code ACTIVITY_RETURN_CODE
                        Integer result of operation.
  -b BEGIN_TIME, --begin_time BEGIN_TIME
                        time of beginning - ')yyyy-mm-dd hh:mm:ss bash format
                        date +'%Y-%m-%d %R:%S'
  -e END_TIME, --end_time END_TIME
                        time of end.Default is invocation time. yyyy-mm-dd
                        hh:mm:ss bash format date + '%Y-%m-%d %R:%S'
  -c COMMENT, --comment COMMENT
                        Any text up to 4GB in lengthArgument structurelog_dip creates a database record that captures the beginning or end of a DIP event.All its operations return an opaque identifier which can reference the record. In bash, this would
be invoked asYou reference the record later by one of two methods:passing in the id from the initial (or subsequent calls):dip_id=$(dip_log--drsDbConfigsec:some.config--begin_time"2021-05-11 01:23:45"--activity_typeDRS--work_nameW12345)dip_log-dsec:some.config--activity_return_code42--end_time"2021-05-11 12:34:56"--dip_id$dip_idusing the work Id, Activity type and begin time:dip_log-dsec:some.config-b"2021-05-11 01:23:45"-aDRS-wW12345

dip_log-dsec:some.config-b"2021-05-11 01:23:45"-aDRS-wW12345-r42-e"2021-05-11 12:34:56"Both of the above examples perform the same function:log the start of a DRS job for work W12345 at  "2021-05-11 01:23:45"log the end_time of the job at "2021-05-11 12:34:56" , with a return code of 42Argument hintsto give an end time, you must give all the job id information, either in the id, or with the (work_name, begin_time,
activity_id) tupleYou can add as much information as you want in one call. If you've captured the begin time, you can
create a call which logs them all at the same time (this is not the best practice, because it eliminates the system's
ability to check for in-progress jobs). This is perfectly legal:dip_log-dsec:some.config-b"2021-05-11 01:23:45"-aDRS-wW12345-r42-e"2021-05-11 12:34:56 -c "HiMom,Imre-writinghistory"Begin and end dates are fussy: in shell, the format for generating the date dip_log requires is:date +%Y-%m-%d %R:%S(for Mac with GNU core, GNU Linuxes)you can update some DIP log properties:commentsend timeoperation return codeObviously, since these are the tuple which identifies the transaction, you cannot modify:work namebegin timeactivity typeIn this example, the comments field is updated.dip_log_id=$(dip_log-dsec:some.config-b"2021-05-11 01:23:45"-aDRS-wW12345-r42-e"2021-05-11 12:34:56 -c "Experiencedsomediscomfort")dip_log -d sec:some.config -i$dip_log_id-c "Butitpassed.")Any property not given in the command line is preserved.  (The example above preserves the begin and end
times of the DIP transaction.)the comment field is a free-form text field of up to 4GB in length. You can store XML or JSON data in it for later
use. (such as any error messages
or summary information about the process or the objects being processed)APIA simple API, inspired byopenpecha.buda.apiis provided as a central library for commonly used utilities, including
Legacy Hack
Image Group TranslationTo use in your code,pip install bdrc-util>=0.9.44bdrc-util ChangelogversionComments0.9.489573f3coptional symlink resolution0.9.47192c43f4Add s3pathlib to install requirements0.9.46e14b3a6decomission web in favor of api0.9.4589724eeRaise pageSize for Get volumes0.9.44TBDMove Resolvers to api0.9.43013242acacheing to reduce load on server0.9.42146bc43asupport buda-dld0.9.410d01394print, dont return fromdisk_ig_from_buda0.9.40Rename get_image_groups0.9.39Added measure archive fixityShorten log file name0.9.38Added RST documentation to setup.Added minimum requirement for bdrc-db-lib0.9.34Use external address for resolver0.9.32be754999 Create entry points for image group renaming0.9.31192eea17 (not released) single entry point for image group renames0.9.3083c5062a Add Work calculation size to script