archipelagentvmcasting :: hypervisorrepomanager :: TNApplianceDownloader :: Class TNApplianceDownloader
[hide private]
[frames] | no frames]

Class TNApplianceDownloader

source code

        object --+        
                 |        
threading._Verbose --+    
                     |    
      threading.Thread --+
                         |
                        TNApplianceDownloader

Implementation of a downloader. This run in a separate thread.

Instance Methods [hide private]
 
__init__(self, url, save_folder, uuid, name, logger, finish_callback)
Initialization of the class.
source code
 
run(self)
Main loop of the thread.
source code
float
get_progress(self)
Returns: the progress percentage of the download
source code
 
get_uuid(self)
Returns: the uuid of the download
source code
 
get_total_size(self)
Returns: the total size in bytes of the download
source code
 
get_name(self)
Returns: the name of the download
source code
 
stop(self)
Stop the download.
source code
 
downloading_callback(self, blocks_count, block_size, total_size)
Internal callback of the download status called by urlretrieve.
source code

Inherited from threading.Thread: __repr__, daemon, getName, ident, isAlive, isDaemon, is_alive, join, name, setDaemon, setName, start

Inherited from threading.Thread (private): _set_daemon, _set_ident

Inherited from threading._Verbose (private): _note

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, url, save_folder, uuid, name, logger, finish_callback)
(Constructor)

source code 

Initialization of the class.

Parameters:
  • url (string) - the url to download
  • save_folder (string) - the folder where the download will be saved
  • uuid (string) - the uuid of the appliance to download
  • name (string) - the name of the download
  • finish_callback (method @param finish_callback the callback method to execute when a download is finished)
Overrides: object.__init__

run(self)

source code 

Main loop of the thread. Will start to download.

Overrides: threading.Thread.run

get_progress(self)

source code 
Returns: float
the progress percentage of the download

get_uuid(self)

source code 
Returns:
the uuid of the download

get_total_size(self)

source code 
Returns:
the total size in bytes of the download

get_name(self)

source code 
Returns:
the name of the download

stop(self)

source code 

Stop the download. NOT IMPLEMENTED

downloading_callback(self, blocks_count, block_size, total_size)

source code 

Internal callback of the download status called by urlretrieve. If percentage reach 100, it will call the finish_callback with uuid as parameter.

Parameters:
  • blocks_count (integer) - the downloaded number of blocks
  • block_size (integer) - the size of one block
  • total_size - the total size in bytes of the file downloaded