cellmap_flow.cli.common

What the cellmap_flow subcommands share.

  • log_level_option: --log-level, which sets the level as soon as it is parsed.

  • ModelTypeGroup: a group with one subcommand per model type, built from the registry when asked for.

  • deprecated: a command under the name it had before 0.3.0, which says what replaces it and then runs it.

  • resample_option: --resample, of infer <type> and serve.

  • dataset_path: the dataset a person gave as -d, checked.

  • agree_to_install: whether to install the pixi environments the models to serve need, asked at a terminal.

Attributes

LOG_LEVELS

REMOVED_IN

Classes

ModelTypeGroup

A group with a subcommand for each model type, besides its own.

Functions

log_level_option([default, help])

--log-level, applied when it is parsed rather than passed on.

resample_option()

--resample/--no-resample, on by default: read the dataset resampled

dataset_path(text) → str

The dataset text, given as -d to view, infer <type> or

deprecation_notice(old, new) → None

Tell the user, on stderr, that old is going and new replaces it.

deprecated(command, old_name, old, new) → click.Command

command as old_name, its name before 0.3.0: hidden from --help,

agree_to_install(models) → None

Settle, before models (model configs) are launched, whether to

Module Contents

cellmap_flow.cli.common.LOG_LEVELS = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']
cellmap_flow.cli.common.REMOVED_IN = 'the release after 0.3.0'
cellmap_flow.cli.common.log_level_option(default=None, help='Set the logging level')

--log-level, applied when it is parsed rather than passed on.

The cellmap_flow group’s defaults to INFO. A subcommand that had its own before 0.3.0 (yaml, view, blockwise) keeps it, defaulting to None, so that cellmap_flow --log-level DEBUG yaml c.yaml is not reset to INFO by the subcommand’s default. Run on its own (python -m, as the dashboard’s blockwise tab runs blockwise), such a subcommand logs at INFO unless told otherwise.

cellmap_flow.cli.common.resample_option()

--resample/--no-resample, on by default: read the dataset resampled to the model’s input voxel size when it has no level at that size (open_raw’s resample=True, cellmap_flow.io.raw). With --no-resample the level chosen is read as if it were at the model’s voxel size, with a warning.

cellmap_flow.cli.common.dataset_path(text: str) → str

The dataset text, given as -d to view, infer <type> or add --run, as cellmap-flow reads it (portable.pasted.pasted_path: a path copied from Neuroglancer without the format it names).

A local path that is not there is a usage error that says so, before anything starts: otherwise it surfaces as worldarray’s list of the metadata files it did not find, at the bottom of a traceback, which reads as if the data were there but malformed. A URL is left to the reader.

class cellmap_flow.cli.common.ModelTypeGroup(*args, make_command, **kwargs)

A group with a subcommand for each model type, besides its own.

make_command(name, config_class) builds a type’s command when click asks for it, from the registry as it is at that moment: a type a plugin defines has its command, and nothing is built at import.

list_commands(ctx)

Returns a list of subcommand names in the order they should appear.

get_command(ctx, name)

Given a context and a command name, this returns a Command object if it exists or returns None.

cellmap_flow.cli.common.deprecation_notice(old: str, new: str) → None

Tell the user, on stderr, that old is going and new replaces it.

cellmap_flow.cli.common.deprecated(command: click.Command, old_name: str, old: str, new: str) → click.Command

command as old_name, its name before 0.3.0: hidden from –help, and saying that new replaces old each time before it runs.

cellmap_flow.cli.common.agree_to_install(models) → None

Settle, before models (model configs) are launched, whether to install the pixi environments they run in that are not installed yet (envs.to_install), as the dashboard’s Models tab asks before its Submit: yaml, infer <type> and add --run.

At a terminal it asks, once for each; declined, that model’s launch is refused, saying how to install it. With no terminal to ask (a Fileglancer app’s run of a YAML, or a command run in the background of a shell: _can_ask), the environment is installed: the run asked for these models, and nobody could answer. Either way it is installed before the model’s job is submitted, never in it (jobs.launch._install_env_first).