Skip to content

Implement task flow #9

@eenblam

Description

@eenblam

Something like this:

tasks
├── 00_setup
├── 01_cases
├── 02_allegations
├── 03_pages
├── 04_participants
└── 05_docket

Ideally, each task can be run by cd tasks/<task_dir>; make. We can iron out specific endpoints as we need them, but here's the Makefile I sketched out for allegations:

SHELL := /bin/bash

all: setup pre task post teardown

clean:
        # Undo everything related to the task. Called manually.
        python3 ./clean.py

setup:
        # Anything that needs to be set up for this specific task
        which python3
        python3 ./setup.py

teardown:
        # Anything that needs to be unset every time
        echo Teardown

pre:
        # Tests post-setup and pre-main
        echo Testing parser
        python3 ./test_parser.py
        echo Testing database state
        python3 ./test_db.py

task:
        python3 ./task.py


post:
        # Tests post-main and pre-teardown
        python3 ./post.py

So:

  • Running make builds the task until it hits a failed stage.
  • make clean will revert any potential changes made by the task.
  • Other steps that part of the all target are meant to do what their comment in the Makefile describes.

Then we can set up a top-level task runner that runs tasks in order until a success. It would also be cool to be able to roll back to a specific number.

For example:

make tasks # Runs tasks 00, 01, 02, 03, 04, but fails on 04. Does not continue to 05.
# (Do some debugging)
make rollback 02 # Roll back to step 02: run `make clean` for 04, then for 03.
# (Do more debugging)
make clean # Undo everything else: run `make clean` for 02, then 01, then 00

Ideally, we:

  • Document what make targets a task should provide, and what constraints they should satisfy.
  • Document how to set up a task (e.g. how to access the Common package)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions