malevich._meta#
- class malevich._meta.AssetFactory#
Creates binary collections (assets) from files or folders
- static on_core(name: str, core_path: str) Asset #
Specifies an asset from a core path
- Parameters:
name (str) – Name of the asset
core_path (str) – Path to the core file
- Returns:
Asset object that is used within @flow function.
- static on_space(reverse_id: str, /) Asset #
- static on_space(reverse_id: str, *, file: str) Asset
- static on_space(reverse_id: str, *, files: list[str]) Asset
- static on_space(reverse_id: str, *, folder_path: str) Asset
Creates or attaches to an asset in the space
- Parameters:
reverse_id (str) – Reverse ID of the space
file (Optional[str], optional) – Path to a single file. Defaults to None.
files (Optional[list[str]], optional) – List of file paths. Defaults to None.
folder_path (Optional[str], optional) – Path to a folder. Defaults to None.
alias (Optional[str], optional) – Alias of the asset. Defaults to None.
- Returns:
Asset object that is used within @flow function.
- static from_file(path: str, name: str | None = None, alias: str | None = None) Asset #
Creates an asset with a single file inside
The argument name is used as a name of the asset, so it should be unique to avoid collisions. If not provided, the name of the file will be used. The name must be a valid Python identifier.
- Parameters:
path (str) – Path to the file
name (Optional[str], optional) – Name of the asset. Defaults to None.
alias (Optional[str], optional) – Alias of the asset. Defaults to None.
- Returns:
Asset object that is used within @flow function.
- static from_files(name: str, *, files: list[str], alias: str | None = None) Asset #
- static from_files(name: str | None = None, *, folder_path: str, alias: str | None = None) Asset
Creates an asset with multiple files inside
Files are read from specified folder path, or using given files (which are not required to be stored together).
Either folder_path or name with files must be provided.
The argument name is used as a name of the asset, so it should be unique to avoid collisions. If not provided, the name of the folder will be used.
- Parameters:
name (Optional[str], optional) – Name of the asset. Defaults to None.
files (Optional[list[str]], optional) – List of files. Defaults to None.
folder_path (Optional[str], optional) – Path to the folder. Defaults to None.
alias (Optional[str], optional) – Alias of the asset. Defaults to None.
- Returns:
Asset object that is used within @flow function.
- malevich._meta.config(**kwargs) dict #
Converts keyword arguments to a configuration
- malevich._meta.flow(fn=None, *, reverse_id: str | None = None, name: str | None = None, description: str | None = None, disable_auto_collections: Literal[True] = False, **kwargs: Any) Callable[[Callable[[Args], T]], FlowFunction[Args, PromisedTask | traced[BaseNode] | Iterable[traced[BaseNode]]]] #
Converts a function into a flow
The function is converted into
malevich.models.flow_function.FlowFunction
object that can be called to produce a task or serve as a subflow.When the function is called from within another
@flow()
decorated function, it returns traced objects to be used as arguments for other flow components. When the function is called from the main context, it returns a task that can be interpreted by any of available interpreters.- Parameters:
reverse_id (str, optional) – Reverse ID of the flow component. Defaults to the name of the function.
name (str, optional) – Name of the flow. Defaults to None.
description (str, optional) – Description of the flow. Defaults to None.
dfs_are_collections (bool, optional) – Whether to treat pandas.DataFrame as a collection. Defaults to False.
**kwargs (Any) – Additional arguments to be passed to the flow component. See
malevich_space.schema.ComponentSchema
for details.
- Returns:
Decorator for the function.
- Return type:
Callable[[Callable[Args, T]], Callable[Args, T]]
- malevich._meta.run(node: T, alias: str | None = None) T #
Tags a node within a flow with additional metadata
- Parameters:
node (T) – Operation to run
alias (Optional[str], optional) – Alias of the operation. Defaults to None.
- class malevich._meta.table(data=None, index: Axes | None = None, columns: Axes | None = None, dtype: Dtype | None = None, copy: bool | None = None)#