utils.notebookhelpers.helpers
Module Contents
Classes
Attributes
- utils.notebookhelpers.helpers.logger
- utils.notebookhelpers.helpers.ds_factory
- class utils.notebookhelpers.helpers.Helpers
- static initH2o(h2o=None, h2oServerUrl=None, init_type=1)
init_type: 0 - connect only, 1-(Default) - init local if cannot connect return: inititalized h2o object
- static get_system_feature_store_redis_host()
- static addParam(context, paramKey, paramVal)
Adds the parameter to the context :param context: :param paramKey: Key of the parameter :param paramVal: Value of the parameter :return:
- static getAllParams(context)
Get all the parameters in the context :param context: :return: List of parameters
- static getParam(context, param)
Get the parameter from the context given the parameter key, if param doesn’t exist, it returns None :param context: :param param: key :return: value of the param
- static get_global_var(context, key)
Get the global variable from the context given the key, if key doesn’t exist, it returns None :param context: :param key: key :return: value of the global var
- static get_secret(context: dict, key: str)
Get the secret value from the context given the key, if key doesn’t exist, it returns None :param context: :param key: key :return: value of the tenant secret
- static getOrCreateArtifactsDir(context, artifactsId, purgeOld=False)
This is used to create artifacts directory, you can save all the artifacts in this directory :param context: :return:
- static uploadArtifacts(context)
- static list_artifact_files(context, artifacts_id)
List the files present in the artifact without downloading the artifact This will not work when doing prepare for local :param context: :param artifacts_id: id of the artifact :return: list of files
- static download_artifact_file(context, artifacts_id, file_name)
Download a single file in artifact without downloading the whole artifact This will not work when doing prepare for local :param context: :param artifacts_id: id of the artifact :param file_name: name of the file :return: downloaded file path
- static downloadArtifacts(context, artifactsId)
- static get_artifact(context, artifact_id, artifact_name)
- static getTenantId(context)
- static getOrCreateContext(contextId, localVars, entities=None)
This is used to create the context, it should be called at start of the file :param contextId: id of the context, if you are testing it locally. In production, it will not be used :param localVars: required parameter, pass it as localvars() :param entities: dictionary of local datasets, if you want local datasets to be used. Key of the dictionary will be name of the dataset and value be local file path :return:
- static getAllEntities(context)
Returns all the entity names in the context :param context: :return: list of all entity names
- static load_all_entities(context)
Load and create dataframe for all the entities in the context :param context: :return: dict of entity name -> dataframe
- static getEntityData(context, entityName, inferDTypesFromSchema=False, numRows=None, pandas_lib=None)
Returns the data of entity as dataframe :param context: :param entityName: name of the entity :param inferDTypesFromSchema: df will have same data types as in schema :param numRows: number of rows to read :return: dataframe
- static get_data_from_source(source_type: utils.rcclient.enums.DataSourceType, source: str, name: str = None, **options)
- static write_data_to_source(df, source_type: utils.rcclient.enums.DataSourceType, target: str, name: str = None, **options)
- static get_datasource(source: utils.rcclient.enums.DataSourceType)
- static getEntityFilePath(context, entityName)
Returns file path of the entity :param context: :param entityName: name of the entity :return: file path of the entity
- static getChildDir(context)
Returns the transform directory, it can be used to save datasets etc. :param context: :return: file path of the directory
- static getOutputCollection(context)
Returns outputCollection, use it to add outputs :param context: :return: outputCollection
- static generate_warning(context, warning)
- static save(context)
Saves the context to the disk, remember to call it at end of your notebook :param context: :return:
- static validate_artifact_added(context)
- static get_rc_ml_model(context, model_name, model_version='default')
- static getValueFromCacheMap(context, cacheKey)
Returns the value from cache map :param context: context :param cacheKey: key in the cache map
Returns: value
- static createTemplateOutput(context, outputName: str, outputType: utils.dtos.templateOutput.OutputType, data=None, dataType: utils.dtos.templateOutput.FileType = FileType.CSV, outputFileName: str = None, custom_params: dict = {}, metadata: dict = {}, description: str = None, group: str = None)
Creates an output for the notebook :param context: :param outputName: name of the output :param outputType: type of the output, check OutputType Enum for supported types :param data: dataframe of the output dataset :param dataType: data type of the output, it can be parquet, csv etc. :param outputFileName: file name of the output :return:
- static create_template_output_rc_ml_model(context, model_name, model_obj, artifacts, version='default')
- static create_template_output_answer(context, answer)
- static create_template_output_metadata(context, metadata_list)
- static create_template_output_artifact(context, artifact_name)
- static createTemplateOutputDataset(context, outputName, dataFrame)
- static create_template_output_chart(context, title, metadata={}, description=None, group=None)
- static createTemplateOutputEChart(context, chartTitle, dataFrame, chartType=ChartType.TABLE, params={}, description=None, group=None)
- static createTemplateOutputPlotlibChart(context, chartTitle: str, plt, description=None, group=None)
- static createTemplateOutputPlotlyChart(context, chartTitle: str, plotly_fig, description=None, group=None)
- static createTemplateOutputPlotlyChartAsJson(context, chartTitle: str, plotly_fig, group=None)
- static createOutputCollection(context)
- static getPreparedData(prepareId)
- static get_or_create_input_var(name, metadata, local_context)
- static get_or_create_input_column_var(name, metadata, local_context)
- static get_or_create_input_data_source_var(name, metadata, local_context)
- static get_or_create_chart_app_var(name, metadata, local_context)
- static get_or_create_input_dataset(name, metadata, local_context, template_id=None, nb_name=None)
- static get_or_create_output_dataset(name, metadata, local_context, template_id=None, nb_name=None)
- static get_or_create_output_chart(name, metadata, local_context, template_id=None, nb_name=None)
- static save_all_vars()
- static get_metadata_value(context, subject_type: utils.dtos.metadata.MetadataSubjectType, subject_name: str, key: str)
- static get_all_metadata(context)
- static __get_or_create_input(variable, local_context)
- static __handle_nb_exec_state(variable)
- static __handle_manual_execution(variable)
- static __handle_compile_time_execution(variable)
- static __handle_runtime_execution(variable)
- static __get_output_filename(context, output_name)
- classmethod __rearrange_ouputs(template_outputs_map)
- classmethod __build_entities_map(context)
- classmethod post_process_entities(entities)