Skip to main content

A job tracker management module

Project description

mps_mongo_prototype

Prototype for mongo instance to be used for IIIF job tracking

Testing

To run the tests:

  1. Copy the env-example.txt to .env and fill in the proper values
  2. Spin up the local docker containers by calling docker-compose -f docker-compose-local.yml up --build --force-recreate
  3. Exec into the mps-job-tracker container: docker exec -it mps-job-tracker bash
  4. Inside the container, run the test: pytest mpsjobtracker/tests/test_job_tracker.py

Development Operations

Docker Compose

Configuration

This package reads configuration values from environment variables.

Installation

$ pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ lts-mpsmqutils
$ python
>>> from mpsmqutils import mqlistener, mqutils
>>> mqutils.__create_message('0922a78fd89f_2a5ff037-462a-4642-8bd0-7546d7580e1a', 1, 'success')

Local Development Environment Setup Instructions

1: Clone the repository to a local directory

git clone git@github.huit.harvard.edu:LTS/mps-jobtracker.git

2: Create app config

Create config file for environment variables
  • Make a copy of the config example file ./env-example.txt
  • Rename the file to .env
  • Replace placeholder values as necessary

Note: The config file .env is specifically excluded in .gitignore and .dockerignore, since it contains credentials it should NOT ever be committed to any repository.

3: Start

START

To build the image without the cache, run the build command with the --no-cache option. The no cache option is required when updating any dependencies.

docker-compose -f docker-compose-local.yml build --no-cache && docker-compose -f docker-compose-local.yml up -d --force-recreate

4: Open a shell in the container

Run docker exec to execute a shell in the container by name

Open a shell using the exec command to access the mps-jobtracker container.

docker exec -it mps-jobtracker bash

5: Install dependencies

This step is only required if additional python dependencies must be installed. Update the requirements.txt inside the container to install new python packages in the project. If the dependencies are required for the package to run, they also must be included in the install_requires section of setup.py.

Install a new pip package

Once inside the mps-jobtracker container, run the pip install command to install a new package and update the requirements text file.

pip install packagename && pip freeze > requirements.txt
Add dependencies to setup

Add the names of the dependencies to the install_requires section of setup.py. Read more about adding dependencies in this article Specifying dependencies.

6: Build and publish the package

Step 6A: Prepare the distribution

  • Update the version number in setup.py
  • To publish a pre-release version, add a letter and a number after the version number e.g. 0.0.1a1
  • Remove the old dist/ directory from the previous build if necessary

Step 6B: Build the distribution

Once inside the container, build the distribution.

python3 setup.py sdist bdist_wheel

A new directory dist will be created in the container.

Step 6C: Register for an account

Register for an account on the test python package repository. Enable two-factor authentication for logins. Create a token.

Step 6D: Upload package to the test repository

Publish the package to the test repository testpypi before publishing it to the production repository.

python3 -m twine upload --repository testpypi dist/*

Step 6E: Test the package

Open the package in the repository and view the version history.

https://test.pypi.org/project/lts-mpsmqutils/0.0.1/

Read Installation in this document for instructions on how to install and test the package in another project or environment.

7: Stop

STOP AND REMOVE

This command stops and removes all containers specified in the docker-compose-local.yml configuration. This command can be used in place of the 'stop' and 'rm' commands.

docker-compose -f docker-compose-local.yml down

More information

Read the documenation for more information on building and publishing the distribution.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

lts_mpsjobtracker_mongo-1.0.0.tar.gz (16.2 kB view details)

Uploaded Source

File details

Details for the file lts_mpsjobtracker_mongo-1.0.0.tar.gz.

File metadata

  • Download URL: lts_mpsjobtracker_mongo-1.0.0.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for lts_mpsjobtracker_mongo-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0b097c6464def84f012dbea9f56433f3ef189e1fb75e3454f4feae7015b60b8d
MD5 0e25875ac3af8074ead4546145f98b2c
BLAKE2b-256 3c1ee44300a83419dbf5fa99f2c4c289afd789adff1eca819190113486901512

See more details on using hashes here.

Supported by

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