Bases: object
Upload and download files using the plowshare tool.
Download a file from one of the provided sources
The sources will be ordered by least amount of errors, so most successful hosts will be tried first. In case of failure, the next source will be attempted, until the first successful download is completed or all sources have been depleted.
Parameters: |
|
---|---|
Returns: | A dict with ‘host_name’ and ‘filename’ keys if the download is successful, or an empty dict otherwise. |
Return type: | dict |
Download a file from a given host.
This method renames the file to the given string.
Parameters: |
|
---|---|
Returns: | Dictionary with information about downloaded file. |
Return type: | dict |
Upload file to multiple hosts simultaneously
The upload will be attempted for each host until the optimal file redundancy is achieved (a percentage of successful uploads) or the host list is depleted.
Parameters: |
|
---|---|
Returns: | A list of dicts with ‘host_name’ and ‘url’ keys for all successful uploads or an empty list if all uploads failed. |
Return type: | list |
Parse plowup’s output.
For now, we just return the last line.
Parameters: |
|
---|---|
Returns: | Parsed and decoded output list. |
Return type: | list |
Retrieve a random subset of available hosts.
The number of hosts provided must not be larger than the number of available of hosts, otherwise it will throw a ValueError exception.
Parameters: | number_of_hosts (int) – Number of hosts to connect to. |
---|---|
Returns: | Random subsample of available hosts. |
Return type: | list |
Raises: | ValueError |
Upload the given file to the specified number of hosts.
Parameters: |
|
---|---|
Returns: | A list of dicts with ‘host_name’ and ‘url’ keys for all successful uploads or an empty list if all uploads failed. |
Return type: | list |
Upload a file to the given host.
This method relies on ‘plowup’ being installed on the system. If it succeeds, this method returns a dictionary with the host name, and the final URL. Otherwise, it returns a dictionary with the host name and an error flag.
Parameters: |
|
---|---|
Returns: | Dictionary containing information about upload to host. |
Return type: | dict |
Enter search terms or a module, class or function name.