Skip to content

App classes

Properties and methods of the app base classes.

scinexus.composable.AppBase

Bases: Generic[T, R]

Base for all app types. Provides call, repr, etc.

Raises:

Type Description
TypeError

If a subclass defines any method name reserved by the app framework. The reserved names depend on the app type.

All app types: __call__, __repr__, __str__, __new__, __copy__, __eq__, _validate_data_type, as_completed, check_data_type, _get_citations, citations, bib.

Composable apps (GENERIC, LOADER, WRITER) additionally: __add__, disconnect, input.

Writer apps additionally: apply_to, set_logger.

bib property

BibTeX formatted string of citations for this app and all composed input apps.

check_data_type property writable

toggle whether the type of input data matches the defined compatible types

Notes

If False, and an invalid data type is passed, the error will still be caught, but in a potentially less informative way. For instance "'NoneType' object has no attribute 'blah'"

citations property

Citations for this app and all composed input apps.

as_completed(dstore, parallel=False, par_kw=None, id_from_source=None, show_progress=False)

invokes self composable function on the provided data store

Parameters:

Name Type Description Default
dstore DataStoreABC | Iterable[Any] | str

a path, list of paths, or DataStore to which the process will be applied.

required
parallel bool

run in parallel, according to arguments in par_kwargs. If True, the last step of the composable function serves as the master process, with earlier steps being executed in parallel for each member of dstore.

False
par_kw dict[str, Any] | None

dict of values for configuring parallel execution.

None
id_from_source GetIdFuncType | None

extracts a unique identifier from each input. If not provided, defaults to the function registered via scinexus.data_store.set_id_from_source, falling back to scinexus.data_store.get_unique_id.

None
show_progress bool | Progress

controls progress bar display. Pass True for the default progress bar, False to disable, or a Progress instance for a custom backend.

False
Notes

If run in parallel, this instance serves as the master object and aggregates results. If run in serial, results are returned in the same order as provided.

scinexus.composable.ComposableApp

Bases: AppBase[T, R]

Adds add for LOADER/GENERIC.

Raises:

Type Description
TypeError

If a subclass defines any method name reserved by the app framework: __call__, __repr__, __str__, __new__, __copy__, __eq__, _validate_data_type, as_completed, check_data_type, _get_citations, citations, bib, __add__, disconnect, input.

bib property

BibTeX formatted string of citations for this app and all composed input apps.

check_data_type property writable

toggle whether the type of input data matches the defined compatible types

Notes

If False, and an invalid data type is passed, the error will still be caught, but in a potentially less informative way. For instance "'NoneType' object has no attribute 'blah'"

citations property

Citations for this app and all composed input apps.

as_completed(dstore, parallel=False, par_kw=None, id_from_source=None, show_progress=False)

invokes self composable function on the provided data store

Parameters:

Name Type Description Default
dstore DataStoreABC | Iterable[Any] | str

a path, list of paths, or DataStore to which the process will be applied.

required
parallel bool

run in parallel, according to arguments in par_kwargs. If True, the last step of the composable function serves as the master process, with earlier steps being executed in parallel for each member of dstore.

False
par_kw dict[str, Any] | None

dict of values for configuring parallel execution.

None
id_from_source GetIdFuncType | None

extracts a unique identifier from each input. If not provided, defaults to the function registered via scinexus.data_store.set_id_from_source, falling back to scinexus.data_store.get_unique_id.

None
show_progress bool | Progress

controls progress bar display. Pass True for the default progress bar, False to disable, or a Progress instance for a custom backend.

False
Notes

If run in parallel, this instance serves as the master object and aggregates results. If run in serial, results are returned in the same order as provided.

disconnect()

Deprecated. No longer required since composition uses copies.

scinexus.composable.LoaderApp

Bases: ComposableApp[T, R]

Intermediate base class for LOADER apps.

Subclasses of LoaderApp are automatically assigned app_type=LOADER. Loaders sit at the start of a composed pipeline and have no input attribute.

Raises:

Type Description
TypeError

If a subclass defines any method name reserved by the app framework: __call__, __repr__, __str__, __new__, __copy__, __eq__, _validate_data_type, as_completed, check_data_type, _get_citations, citations, bib, __add__, disconnect, input.

Examples:

Define a loader by inheritance::

class my_loader(LoaderApp):
    def main(self, path):
        return path

bib property

BibTeX formatted string of citations for this app and all composed input apps.

check_data_type property writable

toggle whether the type of input data matches the defined compatible types

Notes

If False, and an invalid data type is passed, the error will still be caught, but in a potentially less informative way. For instance "'NoneType' object has no attribute 'blah'"

citations property

Citations for this app and all composed input apps.

as_completed(dstore, parallel=False, par_kw=None, id_from_source=None, show_progress=False)

invokes self composable function on the provided data store

Parameters:

Name Type Description Default
dstore DataStoreABC | Iterable[Any] | str

a path, list of paths, or DataStore to which the process will be applied.

required
parallel bool

run in parallel, according to arguments in par_kwargs. If True, the last step of the composable function serves as the master process, with earlier steps being executed in parallel for each member of dstore.

False
par_kw dict[str, Any] | None

dict of values for configuring parallel execution.

None
id_from_source GetIdFuncType | None

extracts a unique identifier from each input. If not provided, defaults to the function registered via scinexus.data_store.set_id_from_source, falling back to scinexus.data_store.get_unique_id.

None
show_progress bool | Progress

controls progress bar display. Pass True for the default progress bar, False to disable, or a Progress instance for a custom backend.

False
Notes

If run in parallel, this instance serves as the master object and aggregates results. If run in serial, results are returned in the same order as provided.

disconnect()

Deprecated. No longer required since composition uses copies.

scinexus.composable.WriterApp

Bases: ComposableApp[T, R]

Adds apply_to and set_logger for WRITER.

Raises:

Type Description
TypeError

If a subclass defines any method name reserved by the app framework: __call__, __repr__, __str__, __new__, __copy__, __eq__, _validate_data_type, as_completed, check_data_type, _get_citations, citations, bib, __add__, disconnect, input, apply_to, set_logger.

bib property

BibTeX formatted string of citations for this app and all composed input apps.

check_data_type property writable

toggle whether the type of input data matches the defined compatible types

Notes

If False, and an invalid data type is passed, the error will still be caught, but in a potentially less informative way. For instance "'NoneType' object has no attribute 'blah'"

citations property

Citations for this app and all composed input apps.

apply_to(dstore, id_from_source=None, parallel=False, par_kw=None, logger=True, cleanup=True, show_progress=False)

invokes self composable function on the provided data store

Parameters:

Name Type Description Default
dstore DataStoreABC | Iterable[Any] | str | Path

a path, list of paths, or DataStore to which the process will be applied.

required
id_from_source GetIdFuncType | None

makes the unique identifier from elements of dstore that will be used for writing results. If not provided, defaults to the function registered via scinexus.data_store.set_id_from_source, falling back to scinexus.data_store.get_unique_id.

None
parallel bool

run in parallel, according to arguments in par_kwargs. If True, the last step of the composable function serves as the master process, with earlier steps being executed in parallel for each member of dstore.

False
par_kw dict[str, Any] | None

dict of values for configuring parallel execution.

None
logger bool | CachingLogger

Controls logging. If True (default), a CachingLogger is created automatically. If False, logging is disabled. A CachingLogger instance can be passed directly.

True
cleanup bool

after copying of log files into the data store, it is deleted from the original location

True
show_progress bool | Progress

controls progress bar display

False

Returns:

Type Description
The output data store instance
Notes

This is an append only function, meaning that if a member already exists in self.data_store for an input, it is skipped.

If run in parallel, this instance spawns workers and aggregates results.

as_completed(dstore, parallel=False, par_kw=None, id_from_source=None, show_progress=False)

invokes self composable function on the provided data store

Parameters:

Name Type Description Default
dstore DataStoreABC | Iterable[Any] | str

a path, list of paths, or DataStore to which the process will be applied.

required
parallel bool

run in parallel, according to arguments in par_kwargs. If True, the last step of the composable function serves as the master process, with earlier steps being executed in parallel for each member of dstore.

False
par_kw dict[str, Any] | None

dict of values for configuring parallel execution.

None
id_from_source GetIdFuncType | None

extracts a unique identifier from each input. If not provided, defaults to the function registered via scinexus.data_store.set_id_from_source, falling back to scinexus.data_store.get_unique_id.

None
show_progress bool | Progress

controls progress bar display. Pass True for the default progress bar, False to disable, or a Progress instance for a custom backend.

False
Notes

If run in parallel, this instance serves as the master object and aggregates results. If run in serial, results are returned in the same order as provided.

disconnect()

Deprecated. No longer required since composition uses copies.

scinexus.composable.NonComposableApp

Bases: AppBase[T, R]

Intermediate base class for NON_COMPOSABLE apps.

Subclasses of NonComposableApp are automatically assigned app_type=NON_COMPOSABLE. Non-composable apps cannot participate in pipeline composition via +.

Raises:

Type Description
TypeError

If a subclass defines any method name reserved by the app framework: __call__, __repr__, __str__, __new__, __copy__, __eq__, _validate_data_type, as_completed, check_data_type, _get_citations, citations, bib.

Examples:

Define a non-composable app by inheritance::

class my_app(NonComposableApp):
    def main(self, val):
        return val

bib property

BibTeX formatted string of citations for this app and all composed input apps.

check_data_type property writable

toggle whether the type of input data matches the defined compatible types

Notes

If False, and an invalid data type is passed, the error will still be caught, but in a potentially less informative way. For instance "'NoneType' object has no attribute 'blah'"

citations property

Citations for this app and all composed input apps.

as_completed(dstore, parallel=False, par_kw=None, id_from_source=None, show_progress=False)

invokes self composable function on the provided data store

Parameters:

Name Type Description Default
dstore DataStoreABC | Iterable[Any] | str

a path, list of paths, or DataStore to which the process will be applied.

required
parallel bool

run in parallel, according to arguments in par_kwargs. If True, the last step of the composable function serves as the master process, with earlier steps being executed in parallel for each member of dstore.

False
par_kw dict[str, Any] | None

dict of values for configuring parallel execution.

None
id_from_source GetIdFuncType | None

extracts a unique identifier from each input. If not provided, defaults to the function registered via scinexus.data_store.set_id_from_source, falling back to scinexus.data_store.get_unique_id.

None
show_progress bool | Progress

controls progress bar display. Pass True for the default progress bar, False to disable, or a Progress instance for a custom backend.

False
Notes

If run in parallel, this instance serves as the master object and aggregates results. If run in serial, results are returned in the same order as provided.