Commit Graph

249 Commits

Author SHA1 Message Date
Alok Saldanha
d747860118 made pruner a daemon thread 2025-11-08 18:40:33 -05:00
Alok Saldanha
79fef57010 updated start scripts to run in subshells 2025-11-08 17:51:06 -05:00
Alok Saldanha
cd9c0a3671 upload coverage reports as artifacts 2025-11-08 17:38:20 -05:00
Alok Saldanha
55b268125f blacken 2025-11-08 17:23:47 -05:00
Alok Saldanha
4df58f9ceb fixe bug in status.json 2025-11-08 17:21:37 -05:00
Alok Saldanha
8b4565e745 added status.json test 2025-11-08 17:21:37 -05:00
Alok Saldanha
c8056991b0 simplify tests 2025-11-08 11:00:07 -05:00
Alok Saldanha
1d1d8b4e59 Address linter warnings 2025-11-08 10:57:50 -05:00
Alok Saldanha
a35c6b9b1e added start scripts for flask, gunicorn and uwsgi 2025-11-05 22:02:56 -05:00
Alok Saldanha
f260180a76 set default_item_source and start pruner thread 2025-11-05 21:54:18 -05:00
Alok Saldanha
58ae41fe0c Delay itemsource initialization until first request is served 2025-11-05 21:41:10 -05:00
Alok Saldanha
0c5adc9fef Merge pull request #99 from andynu/gunicorn-support
Gunicorn support for now. Will revisit populating item sources on module load to improve reusability of module (specifically in tests for now).
2025-11-05 06:55:39 -05:00
Alok Saldanha
34ac73ba01 second attempt to skip codecov on PRs from forks 2025-11-05 06:47:33 -05:00
Alok Saldanha
d16a97906c Skip codecov for PRs from fork 2025-11-05 06:44:54 -05:00
Alok Saldanha
3e5accad65 fixed linting and tests 2025-11-04 06:57:43 -05:00
Andy
903d25763f Fix AttributeError by storing ItemSource objects in default_item_source
Previously, default_item_source was set to a string ("s3" or "local"),
but matching_source() tried to access default_item_source.name, causing:
  AttributeError: 'str' object has no attribute 'name'

This bug occurred when source_name=None (single data source configuration)
and has existed since the ItemSource interface was introduced in 2021.

Changes:
- Store the actual ItemSource object reference instead of string name
- Assign to intermediate variables (s3_source, file_source) for clarity

Fixes the error when viewing datasets with a single data source configured.
2025-10-29 14:08:56 -04:00
Andy
08c546f40a Fix WSGI server initialization by extracting data source setup
Addresses the issue where Gunicorn/uWSGI servers import the gateway
module but never call main(), leaving item_sources empty and causing
the file crawler to fail.

Changes:
- Extract data source initialization into initialize_data_sources()
- Call initialization at module import time for WSGI compatibility
- Add _initialized flag to prevent double initialization
- Simplify main() to delegate to initialize_data_sources()

This ensures data sources are populated when running under WSGI servers
(Gunicorn, uWSGI) while maintaining backward compatibility with the
Flask development server.

Related to GitHub issues #33 and #92
2025-10-29 14:08:56 -04:00
Andy
b9f4d35812 Fix UnicodeDecodeError when viewing compressed datasets
When viewing datasets through the gateway, requests would fail with:
  UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 1

The gateway was copying the accept-encoding header from browser requests
when proxying to cellxgene backend servers. When accept-encoding is
manually set, the Python requests library assumes the caller will handle
decompression and leaves response content compressed.

The cellxgene server responded with zstd-compressed content (magic bytes
28 b5 2f fd), but the gateway attempted to decode this compressed binary
data as UTF-8 text, causing the decode error.

Solution: Remove accept-encoding from the copied headers list in
cache_entry.py. This allows the requests library to automatically handle
compression negotiation and transparently decompress responses (gzip,
deflate, brotli, zstd, etc.).

This is the standard practice when proxying with requests and maintains
all other gateway functionality (URL rewriting, auth, caching, etc.).

Tested:
- Dataset viewing works with compressed responses
- File browser and static assets load correctly
- URL rewriting continues to function properly
2025-10-29 14:04:25 -04:00
Alok Saldanha
05a95c2ca9 Prepare 0.4.0 release v0.4.0 2024-03-10 09:33:50 -04:00
Alok Saldanha
5d29153544 #87 remove version pins for markupsafe, flask and werkzeug
also remove dependency on flask-api
2024-03-10 09:31:39 -04:00
Alok Saldanha
6a2bc409db Prepare for 0.3.12 release v0.3.12 2024-03-03 07:45:47 -05:00
Alok Saldanha
fa72481b66 Merge remote-tracking branch 'origin/dependabot/pip/werkzeug-2.3.8' 2024-03-03 07:33:03 -05:00
Alok Saldanha
3d0166904b Merge pull request #90 from Novartis/dependabot/pip/flask-2.2.5
Bump flask from 2.2.2 to 2.2.5
2024-03-03 07:31:42 -05:00
Alok Saldanha
4e63ff95a8 #87 blacken 2024-03-02 12:25:21 -05:00
Alok Saldanha
c1111e2cb4 #87 patch enable annotations 2024-03-02 12:23:11 -05:00
Alok Saldanha
c4b9084286 #87 Fix test 2024-03-02 12:08:57 -05:00
dependabot[bot]
0282da03c8 Bump werkzeug from 2.3.0 to 2.3.8
Bumps [werkzeug](https://github.com/pallets/werkzeug) from 2.3.0 to 2.3.8.
- [Release notes](https://github.com/pallets/werkzeug/releases)
- [Changelog](https://github.com/pallets/werkzeug/blob/main/CHANGES.rst)
- [Commits](https://github.com/pallets/werkzeug/compare/2.3.0...2.3.8)

---
updated-dependencies:
- dependency-name: werkzeug
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-02 16:56:15 +00:00
dependabot[bot]
bec74bec45 Bump flask from 2.2.2 to 2.2.5
Bumps [flask](https://github.com/pallets/flask) from 2.2.2 to 2.2.5.
- [Release notes](https://github.com/pallets/flask/releases)
- [Changelog](https://github.com/pallets/flask/blob/main/CHANGES.rst)
- [Commits](https://github.com/pallets/flask/compare/2.2.2...2.2.5)

---
updated-dependencies:
- dependency-name: flask
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-02 16:56:15 +00:00
Alok Saldanha
35c8e8180c #87 temporarily pin versions 2024-03-02 11:55:07 -05:00
Alok Saldanha
0000a60eb0 #73 hide annotation links when disabled 2024-03-02 11:51:20 -05:00
Alok Saldanha
1e02e0abb8 Merge pull request #74 from Novartis/73_reorder_filecrawl
#73 moved new annotation link to front
2024-03-02 11:44:49 -05:00
Alok Saldanha
66cca86b51 Merge remote-tracking branch 'ghall/just_gene_sets' 2024-03-02 11:09:00 -05:00
Alok Saldanha
f046e7c5d2 Merge pull request #88 from Mye-InfoBank/master
Fix dockerfile installation problems
2024-02-24 09:22:49 -05:00
Nico Trummer
a8f6e45f34 Implement pip upgrade to Dockerfile 2024-02-21 09:47:46 +01:00
george-hall-ucl
19caa6cb80 Sorry -- forgot to lint 2023-08-08 16:04:03 +01:00
george-hall-ucl
56bd079024 Save gene sets without cell annotations
This fixes a bug whereby new gene_sets csv files created without
accompanying cell-level annotations could not be detected by the
filecrawler.
2023-08-08 15:49:57 +01:00
Alok Saldanha
9d10932b06 prepare for 0.3.11 release v0.3.11 2023-07-09 19:27:32 -04:00
Alok Saldanha
c7c156b4cf Merge pull request #77 from aeisenbarth/filter-empty-folders
Filter directories without h5ad files
2023-07-09 07:04:06 -06:00
Alok Saldanha
624d1f8567 #78 Revert "Rename argument "filter" to "subpath""
This reverts commit fdd6cca297.
2023-07-09 08:25:27 -04:00
Alok Saldanha
79c3f588b6 Merge pull request #80 from Novartis/79_add_docker_example
79 add docker example
2023-07-09 06:05:50 -06:00
Alok Saldanha
d8fd07572c Merge pull request #83 from Novartis/81_gene_set_support
gene set support
2023-07-09 06:03:33 -06:00
Alok Saldanha
64d636a1c5 #81 added unit test for gene sets 2023-07-09 07:46:01 -04:00
Alok Saldanha
7b314d4457 #81 switch to latest ubuntu 2023-07-06 17:15:00 -06:00
Alok Saldanha
2754bc1ef1 #81 Combined GATEWAY_ENABLE_ANNOTATIONS and GATEWAY_ENABLE_GENE_SETS flags 2023-07-06 08:53:19 -06:00
Alok Saldanha
5a650334df #81 moved gene set check into fileitem_source 2023-07-06 08:18:50 -06:00
george-hall-ucl
81c8ce4219 #81 Add support for gene sets
This adds the flag `GATEWAY_ENABLE_GENE_SETS` to enable support for gene
sets.  To simplify implementation, activating this flag also activates
`GATEWAY_ENABLE_ANNOTATIONS`.  The gene sets are saved in a file that
has the same name as the annotations `csv` but with `_gene_sets`
appended to the file name (before the extension).  This file is hidden
in filecrawler, and the gene sets are loaded when the associated
annotations file is loaded.

If the annotations file is missing, then an Exception is raised.

I have updated one unit test to make it expect
`--disable-gene-sets-save` in the default case (i.e. if
`GATEWAY_ENABLE_ANNOTATIONS = 0`).  All units tests pass.

I have updated the README to document `GATEWAY_ENABLE_GENE_SETS`.
2023-07-06 07:59:12 -06:00
Alok Saldanha
f296efcc55 #79 added cellxgene-data directory so it actually works 2022-12-21 16:02:50 -05:00
Alok Saldanha
facfb27d5c #79 add simple example to customize cellxgene-gateway ui 2022-12-21 15:42:13 -05:00
Andreas Eisenbarth
6607b15085 Exclude directories having no h5ad files 2022-10-12 17:31:22 +02:00
Andreas Eisenbarth
0e92b73347 Add test case for dirs without h5ad 2022-10-12 17:31:22 +02:00