caterva2.Client.lazyexpr#
- Client.lazyexpr(name, expression, operands=None, compute=False)#
Creates a lazy expression dataset in personal space.
A dataset with the specified name will be created or overwritten if already exists.
- Parameters:
name¶ (str) – Name of the dataset to be created (without extension).
expression¶ (str) – Expression to be evaluated, which must yield a lazy expression.
operands¶ (dict) – Mapping of variables in the expression to their corresponding dataset paths.
compute¶ (bool, optional) – If false, generate lazyexpr and do not compute anything. If true, compute lazy expression on creation and save (full) result. Default false.
- Returns:
Path of the created dataset.
- Return type:
Path
Examples
>>> import caterva2 as cat2 >>> import numpy as np >>> # To create a lazyexpr you need to be a registered used >>> client = cat2.Client('https://cat2.cloud/demo', ("joedoe@example.com", "foobar")) >>> src_path = f'@personal/dir{np.random.randint(0, 100)}/ds-4d.b2nd' >>> path = client.upload('root-example/dir1/ds-2d.b2nd', src_path) >>> client.lazyexpr('example-expr', 'a + a', {'a': path}) PurePosixPath('@personal/example-expr.b2nd') >>> 'example-expr.b2nd' in client.get_list('@personal') True