Skip to content

Testing Local MacOS Pipeline

Mack edited this page Aug 28, 2023 · 3 revisions

First Time Local Testing Setup

Installing Python

First, we need to install python locally. Open up python V 3.10.12 and download the correct installer executable. Run it and finish the install.

We now need to verify pip was installed with your python download. Use the where pip command to verify that Python can find pip in its program files. This should return a local filepath if successful.

This may require changing directory, and can also involve using alternate commands:

python3 -m where pip

Installing Poetry

Now, we need to install poetry. We can use pip to do this:

  1. Enter pip install poetry in your command line. Make sure this is successful. If you have difficulties, try using:
python3 -m pip install poetry
  1. Next, install the poetry dependencies by entering poetry install

Downloading pipeline (local copy)

Now, we need to download the codebase from github and store it locally.

Method 1: Manual Download

  1. Go to the precision feedback pipeline repo, then hit the green code menu (looks like <> Code v) and download the whole repo as a zip file.
  2. Extract the zip file's contents in a place you can remember (or copy/paste somewhere). !! Know where you are dropping it, you will need that filepath going forward !!

Method 2: Git Clone

  1. Change directory to where you intend to download the local repo copy. This can be somewhere like /usr/local/.../Code/:
cd /path/to/working/directory/
  1. Now it's time to clone the repo. Use the code below to clone the repo, note that whatever directory your terminal is in will be where it is cloned:
git clone  https://github.com/Display-Lab/precision-feedback-pipeline/tree/main

Running a PFP instance locally

This checklist will help you run a local copy of the pipeline on your machine.

In command line where pfp_api codebase is, type the command - poetry run uvicorn main:app --reload. This will run the startup process on the pipeline on your machine, and does so with auto-redeploy on so you can make changes to the pipeline python scripts and the pipeline will update to reflect these changes once the files get saved.

Sending Post Requests

Check out the Postman Workflow setup wiki here if this is your first time working with Postman. It will save you a lot of time and walk you through how to use the program. If not, make sure you have the pipeline running locally, open your postman, and start sending post requests!

  1. Send a POST request to the ip address 127.0.0.1:8000/createprecisionfeedback/ with details present in input_message.json using the postman app

  2. If you are running the pipeline locally and want to see intermediate files have the debug="yes" in the post body.

  3. If you want to set export variable for the causal pathways in the pipeline, you can do so by using the command:

poetry export PATHWAYS=https://github.com/Display-Lab/knowledge-base/tree/main/causal_pathways
poetry export measures=https://raw.githubusercontent.com/Display-Lab/knowledge-base/main/measures.json
poetry export templates=https://github.com/Display-Lab/knowledge-base/tree/main/message_templates

Or you can use:

export PATHWAYS=/Users/username/knowledge-base/causal_pathways
export templates=/Users/username/knowledge-base/templates
export measures='file:///Users/username/knowledge-base/measures.json'

Debugging

There is an option in the current main.py that looks for a defined "debug" value in the postman request. As of 7/18/23, this means you need to go into the postman request and define a variable as debug, and set a value to "yes" or "no".

Clone this wiki locally