# swf-feed-sender

Feed Sender framework using SWF. Defines 2 flows:

- Send new products to Proper
- Send product updates to Proper

The [swf_feed_sender SWF](https://us-east-1.console.aws.amazon.com/swf/v2/home?region=us-east-1#/domains/prod_swf_feed_sender) is triggered on a schedule from jenkins jobs

- [swf-proper-new-releases-exec](https://scheduler.theorchard.io/job/swf-proper-new-releases-exec/)
- [swf-proper-changed-releases-exec](https://scheduler.theorchard.io/job/swf-proper-changed-releases-exec/)

The SWF executions use the deployed `swf-proper-out` ECS tasks to perform work.

## Running linting and unit tests

Tests can be run using the built in docker stack. Generate local AWS credentials to be able to access ECR images.

```sh
docker compose run --rm --build lint-and-test
```

## Local python development

You can optionally run code locally using the following instructions:

### Setup Environment

The environment variables for the app are defined in the `.env.shadow`

Update these to the appropriate values, copy the file to `.env`, and then run `source .env`

### Setup python

```sh
python3 -m venv env
. ./env/bin/activate
pip install -U pip setuptools wheel
pip install -r reqs.pip
```

### Running the app locally

```sh
# {flow_name} is the folder name under feed_sender/flows/
garcon decider {flow_name}
garcon worker {flow_name}
garcon exec {flow_name}
```
