The api.objects.FileArtifact
class¶
Inherits from ABC
> SimvueObject
> ArtifactBase
File based artifact modification and creation class.
Methods¶
__init__(...)¶
Initialise a new file artifact connection.
Parameters
identifier | str | None |
= None |
the identifier of this object on the server. |
attach_to_run(...)¶
Attach this artifact to a given run.
Parameters
run_id | str |
identifier of run to associate this artifact with. |
|
category | Literal['code', 'input', 'output'] |
category of this artifact with respect to the run. |
commit()¶
Not applicable, cannot commit single write artifact.
count()¶
Return the total number of entries for this object type from the server.
Returns
int
total from server database for current user.
delete()¶
Delete the server entry for this object.
Returns
dict[str, Any]
response from server on deletion.
download_content()¶
Stream artifact content.
Yields
bytes
artifact content from server.
Returns
Generator[bytes, None, None]
get(...)¶
Retrieve items of this object type from the server.
Parameters
count | Optional[Annotated[int, Gt(gt=0)]] |
= None |
limit number of objects |
offset | Optional[Annotated[int, Ge(ge=0)]] |
= None |
set start index for objects list |
Yields
tuple[str, SimvueObject | None]
object corresponding to an entry on the server.
Returns
Generator[tuple[str, SimvueObject | None], None, None]
get_category()¶
Retrieve the category of this artifact with respect to a given run.
Returns
Literal['input', 'output', 'code']
ids(...)¶
Retrieve a list of all object identifiers.
Parameters
count | int | None |
= None |
limit number of objects |
offset | int | None |
= None |
set start index for objects list |
Yields
str
identifiers for all objects of this type.
new(...)¶
Create a new artifact either locally or on the server Note all arguments are keyword arguments
Parameters
name | Annotated[str, FieldInfo(annotation=None, required=True, metadata=[_PydanticGeneralMetadata(pattern='^[a-zA-Z0-9\\-\\_\\s\\/\\.:]+$')])] |
the name for this artifact |
|
storage | str | None |
the identifier for the storage location for this object |
|
file_path | Annotated[pathlib._local.Path, Path(path_type='file')] |
path to the file this artifact represents |
|
mime_type | str | None |
the mime type for this file, else this is determined |
|
metadata | dict[str, Any] | None |
supply metadata information for this artifact |
|
offline | bool |
= False |
whether to define this artifact locally, default is False |
on_reconnect(...)¶
Operations performed when this artifact is switched from offline to online mode.
Parameters
id_mapping | dict[str, str] |
mapping from offline identifier to new online identifier. |
read_only(...)¶
Set whether this object is in read only state.
Parameters
is_read_only | bool |
whether object is read only. |
refresh()¶
Refresh staging from local data if in read-only mode.
to_dict()¶
Convert object to serializable dictionary.
Returns
dict[str, Any]
dictionary representation of this object
Properties¶
checksum¶
Retrieve the checksum for this artifact.
Returns
str
created¶
Retrieve created datetime for the artifact.
Returns
datetime.datetime | None
download_url¶
Retrieve the URL for downloading this artifact
Returns
simvue.api.url.URL | None
id¶
The identifier for this object if applicable.
Returns
str | None
mime_type¶
Retrieve the MIME type for this artifact.
Returns
str
name¶
Retrieve name for the artifact.
Returns
str | None
original_path¶
Retrieve the original path of the file associated with this artifact.
Returns
str
runs¶
Retrieve all runs for which this artifact is related.
Yields
str
run identifier for run associated with this artifact
Returns
Generator[str, None, None]
size¶
Retrieve the size for this artifact in bytes.
Returns
int
staged¶
Return currently staged changes to this object.
Returns
dict[str, Any] | None
the locally staged data if available.
storage_id¶
Retrieve the storage identifier for this artifact.
Returns
str | None
storage_url¶
Retrieve upload URL for artifact.
Returns
simvue.api.url.URL | None
uploaded¶
Returns
bool
url¶
The URL for accessing this object on the server.
Returns
simvue.api.url.URL | None