@@ -44,6 +44,7 @@ def __init__(self, *args, **kwargs):
4444 self ._add_configuration (kwargs , 'TaskOnKart' )
4545 # 'This parameter is dumped into "workspace_directory/log/task_log/" when this task finishes with success.'
4646 self .task_log = dict ()
47+ self .task_unique_id = None
4748 super (TaskOnKart , self ).__init__ (* args , ** kwargs )
4849 self ._rerun_state = self .rerun
4950
@@ -118,7 +119,7 @@ def make_model_target(self,
118119 use_unique_id : bool = True ):
119120 """
120121 Make target for models which generate multiple files in saving, e.g. gensim.Word2Vec, Tensorflow, and so on.
121-
122+
122123 :param relative_file_path: A file path to save.
123124 :param save_function: A function to save a model. This takes a model object and a file path.
124125 :param load_function: A function to load a model. This takes a file path and returns a model object.
@@ -178,6 +179,10 @@ def dump(self, obj, target: Union[None, str, TargetOnKart] = None) -> None:
178179 self ._get_output_target (target ).dump (obj )
179180
180181 def make_unique_id (self ):
182+ self .task_unique_id = self .task_unique_id or self ._make_hash_id ()
183+ return self .task_unique_id
184+
185+ def _make_hash_id (self ):
181186 def _to_str_params (task ):
182187 if isinstance (task , TaskOnKart ):
183188 return str (task .make_unique_id ())
0 commit comments