/  Python Yamcs Client  /  File Transfer  /  Model

Model

class yamcs.client.EntityInfo(proto)

Bases: object

property id: str

Entity ID

property name: str

Name of the entity

class yamcs.client.FileTransferCapabilities(proto)

Bases: object

property download: bool
property filelist: bool
property has_transfer_type: bool
property pause_resume: bool
property remote_path: bool
property upload: bool
class yamcs.client.FileTransferOption(proto)

Bases: object

property allow_custom_option: bool

Whether using different values from the pre-set ones is allowed

property associated_text: str

Text associated with the option

property default: Any

Default value for the option

property description: str

Description for the option

property name: str

Name of the option

property type: str

Type of the option

property values

List of possible values for the option

class yamcs.client.RemoteFile(proto)

Bases: object

Represents a file on a remote entity.

property display_name: Optional[str]

Optionally, a preferred displayed name of the file.

property is_directory: bool

Whether the file is a directory

property modified: Optional[datetime]

Latest modification time of the file

property name: str

Identifying name of the file

property size: int

File size in bytes

class yamcs.client.RemoteFileListing(proto)

Bases: object

Represents a list of files from a remote.

property destination: str

Remote destination of the file list

property files: List[RemoteFile]

List of files

property list_time: datetime

Time the file list was made

property remote_path: str

Remote directory of the file list

class yamcs.client.FileTransferService(proto, service_client: FileTransferServiceClient)

Bases: object

cancel_transfer(id: str) None

Cancel a transfer

property capabilities: FileTransferCapabilities

Transfer capabilities

create_filelist_subscription(on_data: Optional[Callable[[RemoteFileListing], None]] = None, timeout: float = 60) FileListSubscription

Create a new filelist subscription.

Parameters:
  • on_data – Function that gets called with RemoteFileListing updates.

  • timeout – The amount of seconds to wait for the request to complete.

Returns:

Future that can be used to manage the background websocket subscription

Return type:

yamcs.client.filetransfer.client.FileListSubscription

create_transfer_subscription(on_data: Optional[Callable[[Transfer], None]] = None, timeout: float = 60) TransferSubscription

Create a new transfer subscription.

Parameters:
  • on_data – Function that gets called with Transfer updates.

  • timeout – The amount of seconds to wait for the request to complete.

Returns:

Future that can be used to manage the background websocket subscription

Return type:

yamcs.client.filetransfer.client.TransferSubscription

download(bucket_name: str, remote_path: str, object_name: Optional[str] = None, source_entity: Optional[str] = None, destination_entity: Optional[str] = None, options: Optional[Mapping[str, Any]] = None) Transfer

Downloads a file from the source to a bucket.

Parameters:
  • bucket_name – Name of the bucket to receive the file.

  • object_name – Name of the file received in the bucket.

  • remote_path – Name of the file to be downloaded from the source.

  • source_entity – Use a specific source entity. (useful in case of multiples)

  • destination_entity – Use a specific destination entity. (useful in case of multiples)

  • options – File transfer options.

fetch_filelist(remote_path: str, source_entity: Optional[str] = None, destination_entity: Optional[str] = None, options: Optional[Mapping[str, Any]] = None)

Sends a request to fetch the directory listing from the remote (destination).

Parameters:
  • remote_path – path on the remote destination to get the file list

  • source_entity – source entity requesting the file list

  • destination_entity – destination entity from which the file list is needed

  • options – option dictionary

get_filelist(remote_path: str, source_entity: Optional[str] = None, destination_entity: Optional[str] = None, options: Optional[Mapping[str, Any]] = None) RemoteFileListing

Returns the latest directory listing for the given destination.

Parameters:
  • remote_path – path on the remote destination to get the file list

  • source_entity – source entity requesting the file list

  • destination_entity – destination entity from which the file list is needed

  • options – option dictionary

property instance: str

Instance of the service

property local_entities: List[EntityInfo]

List of local entities

property name: str

Name of this service.

pause_transfer(id: str) None

Pauses a transfer

property remote_entities: List[EntityInfo]

List of remote entities

resume_transfer(id: str) None

Resume a transfer

run_file_action(file: str, action: str, message: Optional[Mapping[str, Any]] = None) Dict[str, Any]

Run an action on a remote file.

Available actions depend on the specific file transfer implementation that is in use use.

New in version 1.9.6.

Parameters:
  • file – Remote file identifier

  • action – Action identifier

  • message – Action message

Returns:

Action result (if the action returns anything)

property transfer_options: List[FileTransferOption]

List of possible transfer options

upload(bucket_name: str, object_name: str, remote_path: str, source_entity: Optional[str] = None, destination_entity: Optional[str] = None, options: Optional[Mapping[str, Any]] = None) Transfer

Uploads a file located in a bucket to a remote destination path.

Parameters:
  • bucket_name – Name of the bucket containing the source object.

  • object_name – Name of the source object.

  • remote_path – Remote destination.

  • source_entity – Use a specific source entity. (useful in case of multiples)

  • destination_entity – Use a specific destination entity. (useful in case of multiples)

  • options – file transfer options

class yamcs.client.Transfer(proto, service_client)

Bases: object

Represents a file transfer.

await_complete(timeout: Optional[float] = None)

Wait for the transfer to be completed.

Parameters:

timeout – The amount of seconds to wait.

property bucket: str
cancel()

Cancel this transfer

property error: Optional[str]

Error message in case the transfer failed.

property id: str

Yamcs-local transfer identifier.

is_complete() bool

Returns whether this transfer is complete. A transfer can be completed, yet still failed.

is_success() bool

Returns true if this transfer was completed successfully.

property object_name: str
pause()

Pause this transfer

property reliable: bool

True if this is a Class 2 CFDP transfer.

property remote_path: str
resume()

Resume this transfer

property size: int

Total bytes to transfer.

property state: Optional[str]

Current transfer state.

property time: Optional[datetime]

Time when the transfer was started.

property transferred_size: int

Total bytes already transferred.