Skip to content

Commit 5058e1d

Browse files
amuellermfeurer
authored andcommitted
add string representation for runs (#391)
1 parent 2513667 commit 5058e1d

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

openml/runs/run.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import openml
1111
from ..tasks import get_task
12-
from .._api_calls import _perform_api_call, _file_id_to_url, _read_url_files
12+
from .._api_calls import _perform_api_call, _file_id_to_url
1313
from ..exceptions import PyOpenMLError
1414

1515

@@ -54,6 +54,17 @@ def __init__(self, task_id, flow_id, dataset_id, setup_string=None,
5454
self.tags = tags
5555
self.predictions_url = predictions_url
5656

57+
def __str__(self):
58+
flow_name = self.flow_name
59+
if len(flow_name) > 26:
60+
# long enough to show sklearn.pipeline.Pipeline
61+
flow_name = flow_name[:26] + "..."
62+
return "[run id: {}, task id: {}, flow id: {}, flow name: {}]".format(
63+
self.run_id, self.task_id, self.flow_id, flow_name)
64+
65+
def _repr_pretty_(self, pp, cycle):
66+
pp.text(str(self))
67+
5768
def _generate_arff_dict(self):
5869
"""Generates the arff dictionary for uploading predictions to the server.
5970

0 commit comments

Comments
 (0)