scverse / pertpy

Perturbation Analysis in the scverse ecosystem.
https://pertpy.readthedocs.io/en/latest/
MIT License
92 stars 19 forks source link

Add file lock during downloading #590

Closed wxicu closed 1 month ago

wxicu commented 1 month ago

PR Checklist

Description of changes The error mentioned in the issue is reproducedby a Snakemake pipeline with rules defined as follows:

# Define the datasets
datasets = ['sciplex_K562', 'sciplex_A549', 'sciplex_MCF7']

# Define the target rule for all datasets
rule all:
    input:
        expand("prepared_{dataset}.h5ad", dataset=datasets)

# Define the rule to prepare data for each dataset
rule prepare_data:
    output: "prepared_{dataset}.h5ad"
    run:
        import pertpy as pt        
        adata = pt.data.srivatsan_2020_sciplex3()
        output_name = f"prepared_{wildcards.dataset}.h5ad"
        open(output_name, 'a').close()

Technical details Adding a file lock has fixed the issue.

Additional context

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 62.23%. Comparing base (df4b8ab) to head (62bd8cc). Report is 2 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #590 +/- ## ========================================== + Coverage 62.19% 62.23% +0.04% ========================================== Files 43 43 Lines 5295 5301 +6 ========================================== + Hits 3293 3299 +6 Misses 2002 2002 ``` | [Files](https://app.codecov.io/gh/theislab/pertpy/pull/590?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=theislab) | Coverage Δ | | |---|---|---| | [pertpy/data/\_dataloader.py](https://app.codecov.io/gh/theislab/pertpy/pull/590?src=pr&el=tree&filepath=pertpy%2Fdata%2F_dataloader.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=theislab#diff-cGVydHB5L2RhdGEvX2RhdGFsb2FkZXIucHk=) | `100.00% <100.00%> (ø)` | | ... and [5 files with indirect coverage changes](https://app.codecov.io/gh/theislab/pertpy/pull/590/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=theislab)