@@ -76,7 +76,7 @@ def test_success_basic(self) -> None:
7676 class Example (gokart .TaskOnKart ):
7777 pass
7878
79- serialized_task = gokart . TaskInstanceParameter (). serialize ( Example ())
79+ path_to_pkl = "path/to/obj"
8080 template_job = self ._get_template_job ()
8181 master = Kannon (
8282 api_instance = None ,
@@ -88,7 +88,7 @@ class Example(gokart.TaskOnKart):
8888 # set os env
8989 os .environ .update ({"TASK_WORKSPACE_DIRECTORY" : "/cache" })
9090 child_job_name = "test-job"
91- child_job = master ._create_child_job_object (child_job_name , serialized_task )
91+ child_job = master ._create_child_job_object (child_job_name , path_to_pkl )
9292
9393 # following should be copied from template_job
9494 self .assertEqual (child_job .api_version , template_job .api_version )
@@ -99,7 +99,7 @@ class Example(gokart.TaskOnKart):
9999 self .assertEqual (child_job .spec .template .spec .containers [0 ].image , template_job .spec .template .spec .containers [0 ].image )
100100 self .assertEqual (child_job .spec .template .spec .restart_policy , template_job .spec .template .spec .restart_policy )
101101 # following should be overwritten
102- self .assertEqual (child_job .spec .template .spec .containers [0 ].command , ["python" , __file__ , "--serialized- task" , f"'{ serialized_task } '" ])
102+ self .assertEqual (child_job .spec .template .spec .containers [0 ].command , ["python" , __file__ , "--task-pkl-path " , f"'{ path_to_pkl } '" ])
103103 self .assertEqual (child_job .metadata .name , child_job_name )
104104 # envvar TASK_WORKSPACE_DIRECTORY should be inherited
105105 child_env = child_job .spec .template .spec .containers [0 ].env
@@ -111,7 +111,7 @@ def test_success_custom_env(self) -> None:
111111 class Example (gokart .TaskOnKart ):
112112 pass
113113
114- serialized_task = gokart . TaskInstanceParameter (). serialize ( Example ())
114+ path_to_pkl = "path/to/obj"
115115 template_job = self ._get_template_job ()
116116 master = Kannon (
117117 api_instance = None ,
@@ -123,7 +123,7 @@ class Example(gokart.TaskOnKart):
123123 # set os env
124124 os .environ .update ({"TASK_WORKSPACE_DIRECTORY" : "/cache" , "MY_ENV0" : "env0" , "MY_ENV1" : "env1" })
125125 child_job_name = "test-job"
126- child_job = master ._create_child_job_object (child_job_name , serialized_task )
126+ child_job = master ._create_child_job_object (child_job_name , path_to_pkl )
127127
128128 child_env = child_job .spec .template .spec .containers [0 ].env
129129 self .assertEqual (len (child_env ), 3 )
@@ -136,7 +136,7 @@ def test_fail_command_set(self) -> None:
136136 class Example (gokart .TaskOnKart ):
137137 pass
138138
139- serialized_task = gokart . TaskInstanceParameter (). serialize ( Example ())
139+ path_to_pkl = "path/to/obj"
140140 template_job = self ._get_template_job ()
141141 template_job .spec .template .spec .containers [0 ].command = ["dummy-command" ]
142142 master = Kannon (
@@ -149,14 +149,14 @@ class Example(gokart.TaskOnKart):
149149 # set os env
150150 os .environ .update ({"TASK_WORKSPACE_DIRECTORY" : "/cache" })
151151 with self .assertRaises (AssertionError ):
152- master ._create_child_job_object ("test-job" , serialized_task )
152+ master ._create_child_job_object ("test-job" , path_to_pkl )
153153
154154 def test_fail_default_env_not_exist (self ) -> None :
155155
156156 class Example (gokart .TaskOnKart ):
157157 pass
158158
159- serialized_task = gokart . TaskInstanceParameter (). serialize ( Example ())
159+ path_to_pkl = "path/to/obj"
160160 template_job = self ._get_template_job ()
161161
162162 cases = [None , ["TASK_WORKSPACE_DIRECTORY" , "MY_ENV0" , "MY_ENV1" ]]
@@ -170,7 +170,7 @@ class Example(gokart.TaskOnKart):
170170 env_to_inherit = case ,
171171 )
172172 with self .assertRaises (ValueError ):
173- master ._create_child_job_object ("test-job" , serialized_task )
173+ master ._create_child_job_object ("test-job" , path_to_pkl )
174174
175175
176176if __name__ == '__main__' :
0 commit comments