Utilities Python Module¶
Module that has the utility functionality for the cart.
-
class
pacifica.cartd.utils.
Cartutils
[source]¶ Class used to provide utility functions for the cart to use.
-
static
available_cart
(uid)[source]¶ Check if the asked for cart tar is available.
Returns the path to tar if yes, false if not. None if no cart.
-
static
check_file_modified_time
(response, cart_file, mycart)[source]¶ Check response for file modified time.
Should be from Archive Interface head request
-
check_file_ready_pull
(response, cart_file, mycart)[source]¶ Check file ready state.
Check response (should be from Archive Interface head request) for bytes per level then returns True or False based on if the file is at level 1 (downloadable)
-
static
check_file_size_needed
(response, cart_file, mycart)[source]¶ Check response (should be from Archive Interface head request) for file size.
-
check_space_requirements
(cart_file, mycart, size_needed, deleted_flag)[source]¶ Check to make sure there is enough space available on disk for the file to be downloaded.
Note it will recursively call itself if there isnt enough space. It will delete a cart first, then call itself until either there is enough space or there is no carts to delete
-
check_status_details
(mycart, cart_file, size_needed, mod_time)[source]¶ Check to see if status response is correct.
Data from the status response is all correct and ready to for the file to be pulled.
-
static
create_bundle_directories
(filepath)[source]¶ Create all the directories in the given path if they do not already exist.
-
classmethod
create_download_path
(cart_file, mycart, abs_cart_file_path)[source]¶ Create the directories that the file will be pulled to.
-
delete_cart_bundle
(cart)[source]¶ Get the path to where a carts file are.
Also attempt to delete the file tree.
-
classmethod
get_path_size
(source)[source]¶ Return the size of a specific directory, including all subdirectories and files.
-
lru_cart_delete
(mycart)[source]¶ Delete the least recently used cart that isnt this one.
Only delete one cart per call.
-
prepare_bundle
(cartid)[source]¶ Check to see if all the files are staged locally.
Before calling the bundling action. If not will call itself to continue the waiting process
-
remove_cart
(uid)[source]¶ Call when a DELETE request comes in.
Verifies there is a cart to delete then removes it.
-
static
set_file_status
(cart_file, cart, status, error)[source]¶ Set the status and/or error for a cart.
-
static