Skip to main content

StoreDatafileDocumentSourceUnit

Unit
DashAI.back.units.StoreDatafileDocumentSourceUnit

Copy a file out of a completed hub download and hash it.

The hub counterpart of StoreUploadedDocumentSourceUnit. The copy keeps the document independent of the download, which can be deleted on its own. The copy keeps the file's own name. Publishes the same keys as its sibling, so whatever parses the source does not care where it came from.

Parameters​

datafile_id : integer, default=1
Identifier of the completed download to take the file from.
selected_file, default=None
Which file inside the download to take, relative to its root. Leave empty to take the first one, ignoring hidden files.
path : string, default=
Directory the original file is copied into, so the document keeps its source even after the upload or the download is gone.

Methods​

execute(self, ctx: DashAI.back.units.context.ExecutionContext) -> None

Defined on StoreDatafileDocumentSourceUnit

Do the unit's work, reading from and writing to the context.

Parameters

ctx : ExecutionContext
The shared execution context.

get_credential(self, name: str)

Defined on ConfigObject

Resolve a registered credential component by name.

Parameters

name : str
Credential component class name (e.g. "HuggingFaceCredential").

Returns

BaseCredential
An instance of the requested credential component.

get_schema(cls) -> dict

Defined on ConfigObject

Generates the component related Json Schema.

Returns

dict
Dictionary representing the Json Schema of the component.

validate(self, ctx: DashAI.back.units.context.ExecutionContext) -> None

Defined on BaseUnit

Check preconditions without executing the unit.

Parameters

ctx : ExecutionContext
The shared execution context.

validate_and_transform(self, raw_data: dict) -> dict

Defined on ConfigObject

It takes the data given by the user to initialize the model and returns it with all the objects that the model needs to work.

Parameters

raw_data : dict
A dictionary with the data provided by the user to initialize the model.

Returns

dict
A validated dictionary with the necessary objects.