MachineLearningNotebooks icon indicating copy to clipboard operation
MachineLearningNotebooks copied to clipboard

OutputFileDatasetConfig.register_on_complete not working.

Open Strauman opened this issue 6 years ago • 5 comments

The register_on_complete method of OutputFileDatasetConfig does not work. OutputFileDatasetConfig gives an error about version being None type. Error message:

Dataset initialization failed: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
> azureml.core.__version__
>> '1.12.0'

Reproduction code

"""
main.py

Creates a to register a csv file as
a dataset. 

Runs a pipeline consisting of one step. The step downloads
the titanic dataset as a csv file.
"""
from azureml.core import Workspace, Experiment
from azureml.pipeline.core import Pipeline
from azureml.data import OutputFileDatasetConfig
from azureml.pipeline.steps import PythonScriptStep
COMPUTE_TARGET_NAME = "SOME_COMPUTE_TARGET"

## Downloads and register titanic csv dataset
ws = Workspace.from_config()

experiment = Experiment(ws, "bug_reproduction")
dstore = ws.get_default_datastore()
titanic_output= OutputFileDatasetConfig("titanic_data").register_on_complete("titanic_dataset")
## Adding a datastore destination here does not change anything

titanic_step = PythonScriptStep(
    name="Prepare dataset based on config",
    source_directory="./",
    script_name="pipeline_step.py",
    compute_target=COMPUTE_TARGET_NAME,
    arguments=["--output_folder", titanic_output],
    outputs=[titanic_output],
    allow_reuse=False
)

pipeline = Pipeline(workspace=ws, steps=[titanic_step])
pipeline_run = experiment.submit(pipeline, regenerate_outputs=True)
pipeline_run.wait_for_completion(show_output=True)

and

"""
pipeline_step.py


Downloads the titanic dataset and writes it to the directory given in the
--output_folder argument
"""

import argparse
import os
import requests
from pathlib import Path
parser = argparse.ArgumentParser()
parser.add_argument("--output_folder")
args, _ = parser.parse_known_args()
## Download titanic dataset
csv_dataset='https://dprepdata.blob.core.windows.net/demo/Titanic.csv'
save_to = Path(args.output_folder) / "titanic.csv"
os.makedirs(args.output_folder, exist_ok=True)
csv_data = requests.get(csv_dataset)
with open(save_to, "wb") as f:
    f.write(csv_data.content)

Strauman avatar Aug 31 '20 06:08 Strauman

It works when using as_upload() on the output.

Strauman avatar Aug 31 '20 06:08 Strauman

thanks for reporting this. we will investigate and get back

MayMSFT avatar Aug 31 '20 18:08 MayMSFT

@Strauman do you mind sharing the stack trace of this error? Dataset initialization failed: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

rongduan-zhu avatar Aug 31 '20 21:08 rongduan-zhu

Thanks for checking this @rongduan-zhu.

@Strauman, I tried all contents you pasted on my computer and all steps made through. The pipeline job succeeded after running for less than 2 min. Here is a list of all azureml-xxx packages on my computer, hopefully it's helpful.

azureml-automl-core                   1.13.0
azureml-core                          1.13.0
azureml-datadrift                     1.12.0
azureml-dataprep                      2.0.7
azureml-dataprep-native               20.0.2
azureml-dataset-runtime               1.13.0
azureml-pipeline                      1.13.0
azureml-pipeline-core                 1.13.0
azureml-pipeline-steps                1.13.0
azureml-telemetry                     1.13.0
azureml-train                         1.13.0
azureml-train-automl-client           1.13.0
azureml-train-core                    1.13.0
azureml-train-restclients-hyperdrive  1.13.0
azureml-widgets                       1.8.0

YuandaXu avatar Aug 31 '20 22:08 YuandaXu

I'll try to reproduce on a different installation. Until then I'll assume it's on my end.

Strauman avatar Sep 01 '20 06:09 Strauman