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

Use All Cores by Default in Scanpy-Scripts #137

Open
anilthanki opened this issue Jan 14, 2025 · 3 comments
Open

Use All Cores by Default in Scanpy-Scripts #137

anilthanki opened this issue Jan 14, 2025 · 3 comments

Comments

@anilthanki
Copy link
Contributor

anilthanki commented Jan 14, 2025

Scanpy can use all cores by default with setting sc.settings.n_jobs = -1. This setting is not configured in scanpy-scripts. Setting all cores by default would improve performance for computationally intensive tasks.

Impetus, see comment:
ebi-gene-expression-group/scxa-tertiary-workflow#1 (comment)

Proposed Solution
Update cli.py in scanpy-scripts to include an argument for setting sc.settings.n_jobs, where default is sc.settings.n_jobs = -1, ensuring all commands adopt the default.

@irisdianauy
Copy link
Contributor

irisdianauy commented Jan 14, 2025

This is the block in scanpy-scripts where we can add the said argument, maybe name it as --default_njobs:

@click.group(cls=NaturalOrderGroup)
@click.option(
"--debug",
is_flag=True,
default=False,
help="Print debug information",
)
@click.option(
"--verbosity",
type=click.INT,
default=3,
help="Set scanpy verbosity",
)
@click.version_option(
version="0.2.0",
prog_name="scanpy",
)
def cli(debug=False, verbosity=3):
"""
Command line interface to [scanpy](https://github.com/theislab/scanpy)
"""
log_level = logging.DEBUG if debug else logging.INFO
logging.basicConfig(
level=log_level,
format=(
"%(asctime)s; %(levelname)s; %(filename)s; " "%(funcName)s(): %(message)s"
),
datefmt="%y-%m-%d %H:%M:%S",
)
logging.debug("debugging")
sc.settings.verbosity = verbosity
return 0

@irisdianauy
Copy link
Contributor

We can apply this change once we've tested the sc tertiary pipeline on newer scanpy and scanpy-scripts versions.

@irisdianauy
Copy link
Contributor

This PR addresses this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants