Back to bricks list
Introduction
Technical Documentation
Other Classes
Base ResourceDownloaderBase
Version

ResourceDownloaderBase

Abstract class to aggregate common methods for resource downloader tasks

Attributes

config_specs: Dictfile_downloader: FileDownloaderinput_specs: InputSpecsmessage_dispatcher: MessageDispatcheroutput_specs: OutputSpecsresource_loader: ResourceLoaderstyle: TypingStyle

Functions

__INIT__

Constructor, please do not overwrite this method, use the init method instead Leave the constructor without parameters

CHECK_BEFORE_RUN

This can be overwritten to perform custom check before running task. See doc of CheckBeforeTaskResult for more information

Parameters:
NameTypeDefault valueDescription
paramsConfigParams
inputsTaskInputs
Return type:
CheckBeforeTaskResult
CREATE_RESOURCE_FROM_FILE

Methode to create the resource from a file (once downloaded) and return it as a task output

Parameters:
NameTypeDefault valueDescription
resource_filestr
uncompress_optionLiteral
Return type:
Resource
CREATE_TMP_DIR

Create a temporary directory. This directory will be deleted after the task is run. Output file or folder are moved out of this directory before it is deleted.

Return type:
str
GET_DEFAULT_OUTPUT_SPEC_TYPE
Parameters:
NameTypeDefault valueDescription
spec_namestr
Return type:
Type
INIT

This can be overwritten to perform custom initialization of the task. This method is called just after the init and before the check_before_run method

LOG_DEBUG_MESSAGE
Parameters:
NameTypeDefault valueDescription
messagestr
LOG_ERROR_MESSAGE
Parameters:
NameTypeDefault valueDescription
messagestr
LOG_INFO_MESSAGE
Parameters:
NameTypeDefault valueDescription
messagestr
LOG_MESSAGE

Store a message in the progress

Parameters:
NameTypeDefault valueDescription
messagestr Message to store in the progress
type_MessageLevel
LOG_SUCCESS_MESSAGE
Parameters:
NameTypeDefault valueDescription
messagestr
LOG_WARNING_MESSAGE
Parameters:
NameTypeDefault valueDescription
messagestr
RUN

This must be overiwritten to perform the task of the task.

This is where most of your code must go

Parameters:
NameTypeDefault valueDescription
paramsConfigParams [description] config
inputsTaskInputs [description] input
Return type:
Dict
RUN_AFTER_TASK

Save share info, clean temp files, etc

UPDATE_PROGRESS_VALUE

Update the progress value

Parameters:
NameTypeDefault valueDescription
valuefloat Value between 0 and 100 of the progress
messagestr If provided a message is stored on the progress
CLASSNAME - @classmethod

Returns the name of the class

Parameters:
NameTypeDefault valueDescription
slugifybool False True to slugify the class name if true, defaults to false , optional
snakefybool False True to snakefy the class name if true, defaults to false , optional
replace_uppercasebool False Replace upper cases by "-" if true, defaults to false , optional
Return type:
str
DECORATED_METHOD_NAMES - @classmethod
Parameters:
NameTypeDefault valueDescription
decorator_nameAny
FULL_CLASSNAME - @classmethod

Returns the full name of the class

Parameters:
NameTypeDefault valueDescription
slugifybool False Slugify the returned class name if true, defaults to false , optional
snakefybool False Snakefy the returned class name if true, defaults to false ``
Return type:
str
GET_BRICK_NAME - @classmethod
Return type:
str
GET_COMPATIBLE_INPUT_NAME - @classmethod

Returns the name of the first compatible input for the given resource types Returns None if no compatible input is found

Parameters:
NameTypeDefault valueDescription
resource_typesList
Return type:
bool
GET_COMPATIBLE_OUTPUT_NAME - @classmethod

Returns the name of the first compatible output for the given resource types Returns None if no compatible output is found

Parameters:
NameTypeDefault valueDescription
resource_typesList
Return type:
bool
GET_HUMAN_NAME - @classmethod

Get the human name of the resource

Return type:
str
GET_INPUT_SPECS - @classmethod

Returns the input specs of the process

Return type:
InputSpecs
GET_OUTPUT_SPECS - @classmethod

Returns the input specs of the process

Return type:
OutputSpecs
GET_SHORT_DESCRIPTION - @classmethod

Get the short description of the resource

Return type:
str
GET_TYPING_NAME - @classmethod

Get the typing name of the resource

Return type:
str
INHERITORS - @classmethod

Get all the classes that inherit this class

Return type:
List
METHOD_NAMES - @classmethod

Returns the list of the methods

Return type:
List
MODULE_NAME - @classmethod

Returns the module name of the class

Return type:
str
PROPERTY_METHOD_NAMES - @classmethod
PROPERTY_NAMES - @classmethod

Retrieves the property names

Parameters:
NameTypeDefault valueDescription
instancetype The s of the properties to retrieve. set `none` to retrieve all. `type` or `union[type]`
excludetype
Return type:
List