Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.9.0 Release #179

Merged
merged 66 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
1e9fbe7
Allow remote schemas. Fix #160
nsheff Feb 22, 2024
f7258d8
simplify schema repr
nsheff Feb 22, 2024
1e084bc
change initialize pipestatbackend to debug instead of warn, https://g…
donaldcampbelljr Mar 13, 2024
0dfe9e3
remove unused reports.py code. check for appendix when getting file f…
donaldcampbelljr Mar 14, 2024
a46ed1e
prep for 0.8.3.a1 release
donaldcampbelljr Mar 14, 2024
fac8a6b
fix rm_record bug using new write_lock
donaldcampbelljr Mar 14, 2024
bf0a393
fix rm_record bug using new write_lock
donaldcampbelljr Mar 14, 2024
db15e0f
update reqs and use lint
donaldcampbelljr Apr 2, 2024
91ff657
replace mk_abs_via_cfg with mkabs, add make_subdirectories
donaldcampbelljr Apr 2, 2024
a091ecb
replace read_yaml_data with yacman's load_yaml
donaldcampbelljr Apr 2, 2024
3e00e41
revert warning per #157
donaldcampbelljr Apr 2, 2024
33c8d92
Merge pull request #162 from pepkit/remote-schemas
donaldcampbelljr Apr 2, 2024
30c7404
attempt adding smokeshow for coverage reporting #167
donaldcampbelljr Apr 3, 2024
ab993e6
add db-backend dependencies #167
donaldcampbelljr Apr 3, 2024
bf8ab88
remove coverage threshold (temporarily) to make the report informatio…
donaldcampbelljr Apr 3, 2024
8fe7087
remove oyaml in favor of pyyaml #144
donaldcampbelljr Apr 3, 2024
3f488fd
remove unused read_yaml_data per PR #162 and issues #160
donaldcampbelljr Apr 3, 2024
492391a
rename variables and add clarity to docstrings for replace_JSON_refs …
donaldcampbelljr Apr 3, 2024
5edd7fc
add clarity to schema validation exception #173
donaldcampbelljr Apr 3, 2024
1fe44eb
fix #171
donaldcampbelljr Apr 3, 2024
86a6483
Set force_overwrite to default to True #161
donaldcampbelljr Apr 4, 2024
30bcccd
version bump for v0.9.0a1 prelease
donaldcampbelljr Apr 4, 2024
4b332ce
initial POC for writing history to results.yaml #177
donaldcampbelljr Apr 4, 2024
c3ffaa7
add retrieve_history function #177
donaldcampbelljr Apr 4, 2024
dfcf9b5
add modification upon result deletion
donaldcampbelljr Apr 5, 2024
d472562
add creation of a link table, history table #177
donaldcampbelljr Apr 5, 2024
64b76be
add one to many for history table, comment out link tables
donaldcampbelljr Apr 5, 2024
1c13ae4
add record to history with creation of new record
donaldcampbelljr Apr 5, 2024
44445fb
add history modification when new results are reported, some tests br…
donaldcampbelljr Apr 5, 2024
fcfcced
fix removal on db_backend with foreign_key_constraint
donaldcampbelljr Apr 5, 2024
b7bf1c8
revert tests to original form
donaldcampbelljr Apr 5, 2024
8bc5ee4
re-do test for retrieving history
donaldcampbelljr Apr 5, 2024
e72c2d3
add retrieve_history_db for db_backend. WIP. Tests broken.
donaldcampbelljr Apr 5, 2024
8001551
fix retrieve_history test for db_backend
donaldcampbelljr Apr 5, 2024
eed50d2
remove unneccessary link table code
donaldcampbelljr Apr 9, 2024
ac6d156
lint
donaldcampbelljr Apr 9, 2024
346435f
continue unifying the history retrieval for both backends
donaldcampbelljr Apr 9, 2024
816e2f1
unifying structure of returned history for db backend and file backends
donaldcampbelljr Apr 9, 2024
a2f0710
update changelog, uncomment tests skipping
donaldcampbelljr Apr 9, 2024
c15df79
updated coverage test
khoroshevskyi Apr 11, 2024
aed739d
change structure for filebackend history and meta keys
donaldcampbelljr Apr 15, 2024
a706c3b
Merge remote-tracking branch 'origin/dev_record_history' into dev_rec…
donaldcampbelljr Apr 15, 2024
080835c
No longer remove record if last result is removed (filebackend)
donaldcampbelljr Apr 15, 2024
787f613
fix list_recent_results with new history data structure for filebackend
donaldcampbelljr Apr 16, 2024
63c60be
add remove_record to main pipestat manager, remove unnecessary tests
donaldcampbelljr Apr 16, 2024
69268b4
add meta_data_bool for filebackend and fix retrieve_history for new d…
donaldcampbelljr Apr 16, 2024
4838840
fix tests, add trieving history with multi results
donaldcampbelljr Apr 16, 2024
144790f
add boolean flag to toggle reporting history
donaldcampbelljr Apr 16, 2024
aa7eae6
if result is exisiting, then place previous result into history
donaldcampbelljr Apr 16, 2024
65ce329
do not add current result to history (db backend)
donaldcampbelljr Apr 16, 2024
c45ef2f
update changelog.md
donaldcampbelljr Apr 16, 2024
94776ab
add a hisotory retrieval test for complex objects, add more assertion…
donaldcampbelljr Apr 17, 2024
9f368d9
add history retrieval to CLI and add test coverage
donaldcampbelljr Apr 17, 2024
09a18b8
doc strings and adding record not found error
donaldcampbelljr Apr 17, 2024
7a2b007
Use insert instead of `+` for appending new columns
donaldcampbelljr Apr 17, 2024
d6a85ff
use a single line to delete linked records
donaldcampbelljr Apr 17, 2024
c1694ea
update doc strings
donaldcampbelljr Apr 17, 2024
04419a4
Revert "use a single line to delete linked records"
donaldcampbelljr Apr 17, 2024
3733c69
revert test check/skip conditions
donaldcampbelljr Apr 17, 2024
2cf054c
minor revision to result structure for db backend history
donaldcampbelljr Apr 18, 2024
cfc8d01
Merge pull request #178 from pepkit/dev_record_history
donaldcampbelljr Apr 18, 2024
ae3ba7c
fix #175
donaldcampbelljr Apr 18, 2024
cb64a67
Merge pull request #180 from pepkit/dev_175_recordidentifier_bug
donaldcampbelljr Apr 18, 2024
da8f60c
update version number to 0.9.0
donaldcampbelljr Apr 18, 2024
a094527
fix CLI bug
donaldcampbelljr Apr 18, 2024
2b1f4ec
tweak changelog.md
donaldcampbelljr Apr 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/cli-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Pipestat Test Coverage

on:
push:
branches: [master, dev]
pull_request:
branches: [ dev ]

jobs:
cli-coverage-report:
strategy:
matrix:
python-version: ["3.10"]
os: [ ubuntu-latest ] # can't use macOS when using service containers or container jobs
runs-on: ${{ matrix.os }}
services:
postgres:
image: postgres
env: # needs to match DB config in: ../../tests/data/config.yaml
POSTGRES_USER: postgres
POSTGRES_PASSWORD: pipestat-password
POSTGRES_DB: pipestat-test
POSTGRES_HOST: localhost
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Install dev dependencies
run: if [ -f requirements/requirements-dev.txt ]; then pip install -r requirements/requirements-dev.txt; fi

- name: Install test dependencies
run: if [ -f requirements/requirements-test.txt ]; then pip install -r requirements/requirements-test.txt; fi

- name: Install backend dependencies
run: if [ -f requirements/requirements-db-backend.txt ]; then pip install -r requirements/requirements-db-backend.txt; fi

- name: Install pipestat
run: python -m pip install .

- name: Run tests
run: coverage run -m pytest

- name: build coverage
run: coverage html -i

- run: smokeshow upload htmlcov
env:
SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage}
#SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 50
SMOKESHOW_GITHUB_CONTEXT: coverage
SMOKESHOW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SMOKESHOW_GITHUB_PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
SMOKESHOW_AUTH_KEY: ${{ secrets.SMOKESHOW_AUTH_KEY }}
13 changes: 8 additions & 5 deletions .github/workflows/run-pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,17 @@ jobs:
- name: Install test dependencies
run: if [ -f requirements/requirements-test.txt ]; then pip install -r requirements/requirements-test.txt; fi

- name: Install backend dependencies
run: if [ -f requirements/requirements-db-backend.txt ]; then pip install -r requirements/requirements-db-backend.txt; fi

- name: Install pipestat
run: python -m pip install .

- name: Run pytest tests
run: pytest tests -x -vv --cov=./ --cov-report=xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
name: py-${{ matrix.python-version }}-${{ matrix.os }}
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v1
# with:
# file: ./coverage.xml
# name: py-${{ matrix.python-version }}-${{ matrix.os }}
15 changes: 15 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format.

## [0.9.0] - 2024-04-19
### Fixed
- Bug with rm_record for filebackend
- Bug when using record_identifier via env variable and the CLI
### Added
- Added results history and history retrieval for both file and db backends via `retrieve_history` [#177](https://github.com/pepkit/pipestat/issues/177).
- Added `remove_record` to Pipestat manager object (it is no longer only on backend classes)
- Added `meta` key to each record for the file backend
- db backend will now create an additional sql history table
- Reporting history is toggleable
### Changed
- Removing the last result no longer removes the entire record.
- `pipestat_created_time, and `pipestat_modified_time` now live under the `meta` key.
- `history` lives under the `meta` key for the filebackend.

## [0.8.2] - 2024-02-22
### Changed
- Changed yacman requirement and using FutureYamlConfigManager.
Expand Down
2 changes: 1 addition & 1 deletion pipestat/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.8.2"
__version__ = "0.9.0"
26 changes: 18 additions & 8 deletions pipestat/argparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
INSPECT_CMD = "inspect"
REMOVE_CMD = "remove"
RETRIEVE_CMD = "retrieve"
HISTORY_CMD = "history"
STATUS_CMD = "status"
INIT_CMD = "init"
SUMMARIZE_CMD = "summarize"
Expand All @@ -26,6 +27,7 @@
SUMMARIZE_CMD: "Generates HTML Report",
LINK_CMD: "Create symlinks of reported files",
SERVE_CMD: "Initializes pipestatreader API",
HISTORY_CMD: "Retrieve history of reported results for one record identifier",
}

STATUS_GET_CMD = "get"
Expand Down Expand Up @@ -169,7 +171,7 @@ def add_subparser(
)

# remove, report and inspect
for cmd in [REMOVE_CMD, REPORT_CMD, INSPECT_CMD, RETRIEVE_CMD]:
for cmd in [REMOVE_CMD, REPORT_CMD, INSPECT_CMD, RETRIEVE_CMD, HISTORY_CMD]:
sps[cmd].add_argument(
"-f",
"--results-file",
Expand Down Expand Up @@ -239,13 +241,21 @@ def add_subparser(
help=f"ID of the record to report the result for. {_env_txt('record_identifier')}",
)

sps[RETRIEVE_CMD].add_argument(
"-r",
"--record-identifier",
type=str,
metavar="R",
help=f"ID of the record to report the result for. {_env_txt('record_identifier')}",
)
for cmd in [RETRIEVE_CMD, HISTORY_CMD]:
sps[cmd].add_argument(
"-i",
"--result-identifier",
type=str,
metavar="I",
help="ID of the result to report; needs to be defined in the schema",
)
sps[cmd].add_argument(
"-r",
"--record-identifier",
type=str,
metavar="R",
help=f"ID of the record to report the result for. {_env_txt('record_identifier')}",
)

# report
sps[REPORT_CMD].add_argument(
Expand Down
3 changes: 2 additions & 1 deletion pipestat/backends/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class PipestatBackend(ABC):
"""Abstract class representing a pipestat backend"""

def __init__(self, pipeline_type):
_LOGGER.warning("Initialize PipestatBackend")
_LOGGER.debug("Initialize PipestatBackend")
self.pipeline_type = pipeline_type

def assert_results_defined(self, results: List[str], pipeline_type: str) -> None:
Expand Down Expand Up @@ -153,6 +153,7 @@ def report(
record_identifier: str,
force_overwrite: bool = False,
result_formatter: Optional[staticmethod] = None,
history_enabled: bool = True,
) -> str:
_LOGGER.warning("Not implemented yet for this backend")

Expand Down
43 changes: 43 additions & 0 deletions pipestat/backends/db_backend/db_parsed_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,49 @@ def _get_data_type(type_name):
def file_like_table_name(self):
return self._table_name("files")

def build_history_model(self, pipeline_type):
"""Creates model for history ORM
:param str pipeline_type: project or sample-level pipeline
:return model: (model, table_name)
"""
if pipeline_type == "project":
history_table_name = self.project_table_name + "_history"
data = self.project_level_data
main_table_id = self.project_table_name + ".id"

elif pipeline_type == "sample":
history_table_name = self.sample_table_name + "_history"
data = self.sample_level_data
main_table_id = self.sample_table_name + ".id"

else:
raise PipestatError(
f"Building model requires pipeline type. Provided type: '{pipeline_type}' "
)

if not self.sample_level_data and not self.project_level_data:
return None

field_defs = self._make_field_definitions(data, require_type=True)
field_defs = self._add_status_field(field_defs)
field_defs = self._add_record_identifier_field(field_defs)
field_defs = self._add_id_field(field_defs)
field_defs = self._add_pipeline_name_field(field_defs)
field_defs = self._add_created_time_field(field_defs)
field_defs = self._add_modified_time_field(field_defs)

field_defs["source_record_id"] = (
int,
Field(
default=None,
foreign_key=main_table_id,
),
)

history_model = _create_model(history_table_name, **field_defs)

return history_model, history_table_name

def build_model(self, pipeline_type):
if pipeline_type == "project":
data = self.project_level_data
Expand Down
Loading
Loading