Skip to content

KeyError on list_tasks #1234

@Innixma

Description

@Innixma

Description

OpenML crashes during list_tasks call.

It was working correctly 1 week ago.
I first noticed the error on March 25th when running a script to generate a task metadata file locally.

I've reproduced the error both on an ubuntu EC2 instance and locally on my Mac laptop.

Steps/Code to Reproduce

import openml
tasks = openml.tasks.list_tasks()

Exception

Traceback (most recent call last):
  File "/home/ubuntu/.conda/envs/code/lib/python3.8/site-packages/openml/tasks/functions.py", line 273, in __list_tasks
    task[input["@name"]] = proc_dict[int(input["#text"])]["name"]
KeyError: 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ubuntu/workspace/code/scratch/scratch2.py", line 2, in <module>
    tasks = openml.tasks.list_tasks()
  File "/home/ubuntu/.conda/envs/code/lib/python3.8/site-packages/openml/tasks/functions.py", line 180, in list_tasks
    return openml.utils._list_all(
  File "/home/ubuntu/.conda/envs/code/lib/python3.8/site-packages/openml/utils.py", line 272, in _list_all
    new_batch = listing_call(
  File "/home/ubuntu/.conda/envs/code/lib/python3.8/site-packages/openml/tasks/functions.py", line 222, in _list_tasks
    return __list_tasks(api_call=api_call, output_format=output_format)
  File "/home/ubuntu/.conda/envs/code/lib/python3.8/site-packages/openml/tasks/functions.py", line 291, in __list_tasks
    raise KeyError("Invalid xml for task %d: %s\nFrom %s" % (tid, e, task_))
KeyError: "Invalid xml for task 361346: 0\nFrom {'oml:task_id': '361346', 'oml:task_type_id': '1', 'oml:task_type': 'Supervised Classification', 'oml:did': '554', 'oml:name': 'mnist_784', 'oml:status': 'active', 'oml:format': 'ARFF', 'oml:input': [{'@name': 'estimation_procedure', '#text': '0'}, {'@name': 'source_data', '#text': '554'}, {'@name': 'target_feature', '#text': 'class'}], 'oml:quality': [{'@name': 'MajorityClassSize', '#text': '7877.0'}, {'@name': 'MaxNominalAttDistinctValues', '#text': '10.0'}, {'@name': 'MinorityClassSize', '#text': '6313.0'}, {'@name': 'NumberOfClasses', '#text': '10.0'}, {'@name': 'NumberOfFeatures', '#text': '785.0'}, {'@name': 'NumberOfInstances', '#text': '70000.0'}, {'@name': 'NumberOfInstancesWithMissingValues', '#text': '0.0'}, {'@name': 'NumberOfMissingValues', '#text': '0.0'}, {'@name': 'NumberOfNumericFeatures', '#text': '784.0'}, {'@name': 'NumberOfSymbolicFeatures', '#text': '1.0'}]}"

Versions

Ubuntu EC2 Instance

Linux-5.15.0-1017-aws-x86_64-with-glibc2.10
Python 3.8.16 | packaged by conda-forge | (default, Feb  1 2023, 16:01:55) 
[GCC 11.3.0]
NumPy 1.23.5
SciPy 1.10.1
Scikit-Learn 1.1.1
OpenML 0.13.1

MacOS Laptop

macOS-10.16-x86_64-i386-64bit
Python 3.8.10 (v3.8.10:3d8993a744, May  3 2021, 08:55:58) 
[Clang 6.0 (clang-600.0.57)]
NumPy 1.22.4
SciPy 1.8.1
Scikit-Learn 1.1.1
OpenML 0.12.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions