Skip to content

Commit

Permalink
chore: log task ID
Browse files Browse the repository at this point in the history
* to make it easier for us to locate tasks' cache
  • Loading branch information
mamo3gr committed Jan 9, 2025
1 parent ff42bf4 commit 393c708
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions gokart/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,13 +540,15 @@ def _get_module_versions(self) -> str:

def __repr__(self):
"""
Build a task representation like `MyTask(param1=1.5, param2='5', data_task=DataTask(id=35tyi))`
Build a task representation like
`MyTask[aca2f28555dadd0f1e3dee3d4b973651](param1=1.5, param2='5', data_task=DataTask(c1f5d06aa580c5761c55bd83b18b0b4e))`
"""
return self._get_task_string()

def __str__(self):
"""
Build a human-readable task representation like `MyTask(param1=1.5, param2='5', data_task=DataTask(id=35tyi))`
Build a human-readable task representation like
`MyTask[aca2f28555dadd0f1e3dee3d4b973651](param1=1.5, param2='5', data_task=DataTask(c1f5d06aa580c5761c55bd83b18b0b4e))`
This includes only public parameters
"""
return self._get_task_string(only_public=True)
Expand All @@ -566,7 +568,7 @@ def _get_task_string(self, only_public=False):
if param_obj.significant and ((not only_public) or param_obj.visibility == ParameterVisibility.PUBLIC):
repr_parts.append(f'{param_name}={self._make_representation(param_obj, param_value)}')

task_str = f'{self.get_task_family()}({", ".join(repr_parts)})'
task_str = f'{self.get_task_family()}[{self.make_unique_id()}]({", ".join(repr_parts)})'
return task_str

def _make_representation(self, param_obj: luigi.Parameter, param_value):
Expand Down

0 comments on commit 393c708

Please sign in to comment.