@@ -246,7 +246,9 @@ def download_annotation_archive(self, project_id: str, dest_path: str) -> str:
246
246
_ , response = self .api .get_annotation_archive (project_id , query_params = query_params )
247
247
url = response .headers ["Location" ]
248
248
response2 = _download (url , dest_path )
249
- logger .debug (f"type=simple_annotation, Last-Modified={ response2 .headers .get ('Last-Modified' )} " )
249
+ logger .debug (
250
+ f"project_id='{ project_id } ', type=simple_annotation, Last-Modified={ response2 .headers .get ('Last-Modified' )} "
251
+ )
250
252
return url
251
253
252
254
def download_full_annotation_archive (self , project_id : str , dest_path : str ) -> str :
@@ -267,7 +269,9 @@ def download_full_annotation_archive(self, project_id: str, dest_path: str) -> s
267
269
_ , response = self .api .get_archive_full_with_pro_id (project_id )
268
270
url = response .headers ["Location" ]
269
271
response2 = _download (url , dest_path )
270
- logger .debug (f"type=full_annotation, Last-Modified={ response2 .headers .get ('Last-Modified' )} " )
272
+ logger .debug (
273
+ f"project_id='{ project_id } ', type=full_annotation, Last-Modified={ response2 .headers .get ('Last-Modified' )} "
274
+ )
271
275
return url
272
276
273
277
def get_all_annotation_list (
@@ -357,7 +361,7 @@ def __to_dest_annotation_detail(
357
361
s3_path = self .upload_data_to_s3 (
358
362
dest_project_id , data = src_response .content , content_type = src_response .headers ["Content-Type" ]
359
363
)
360
- logger .debug ("%s に外部アノテーションファイルをアップロードしました。" , s3_path )
364
+ logger .debug ("project_id='%s', %s に外部アノテーションファイルをアップロードしました。" , dest_project_id , s3_path )
361
365
dest_detail ["path" ] = s3_path
362
366
dest_detail ["url" ] = None
363
367
dest_detail ["etag" ] = None
@@ -427,7 +431,7 @@ def copy_annotation(
427
431
src_annotation_details : List [Dict [str , Any ]] = src_annotation ["details" ]
428
432
429
433
if len (src_annotation_details ) == 0 :
430
- logger .debug ("コピー元にアノテーションが1つもないため、アノテーションのコピーをスキップします。" )
434
+ logger .debug (f "コピー元にアノテーションが1つもないため、アノテーションのコピーをスキップします。:: src=' { src } ' " )
431
435
return False
432
436
433
437
old_dest_annotation , _ = self .api .get_editor_annotation (dest .project_id , dest .task_id , dest .input_data_id )
@@ -574,7 +578,7 @@ def __to_annotation_detail_for_request(
574
578
try :
575
579
s3_path = self .upload_data_to_s3 (project_id , f , content_type = "image/png" )
576
580
dest_obj ["path" ] = s3_path
577
- logger .debug (f"{ outer_file_path } をS3にアップロードしました。" )
581
+ logger .debug (f"project_id=' { project_id } ', { outer_file_path } をS3にアップロードしました。" )
578
582
579
583
except CheckSumError as e :
580
584
message = (
@@ -1574,7 +1578,9 @@ def download_project_inputs_url(self, project_id: str, dest_path: str) -> str:
1574
1578
content , _ = self .api .get_project_inputs_url (project_id )
1575
1579
url = content ["url" ]
1576
1580
response2 = _download (url , dest_path )
1577
- logger .debug (f"type=input_data, Last-Modified={ response2 .headers .get ('Last-Modified' )} " )
1581
+ logger .debug (
1582
+ f"project_id='{ project_id } ', type=input_data, Last-Modified={ response2 .headers .get ('Last-Modified' )} "
1583
+ )
1578
1584
return url
1579
1585
1580
1586
def download_project_tasks_url (self , project_id : str , dest_path : str ) -> str :
@@ -1594,7 +1600,7 @@ def download_project_tasks_url(self, project_id: str, dest_path: str) -> str:
1594
1600
content , _ = self .api .get_project_tasks_url (project_id )
1595
1601
url = content ["url" ]
1596
1602
response2 = _download (url , dest_path )
1597
- logger .debug (f"type=task, Last-Modified={ response2 .headers .get ('Last-Modified' )} " )
1603
+ logger .debug (f"project_id=' { project_id } ', type=task, Last-Modified={ response2 .headers .get ('Last-Modified' )} " )
1598
1604
return url
1599
1605
1600
1606
def download_project_inspections_url (self , project_id : str , dest_path : str ) -> str :
@@ -1614,7 +1620,10 @@ def download_project_inspections_url(self, project_id: str, dest_path: str) -> s
1614
1620
content , _ = self .api .get_project_inspections_url (project_id )
1615
1621
url = content ["url" ]
1616
1622
response2 = _download (url , dest_path )
1617
- logger .debug (f"type=inspection_comment, Last-Modified={ response2 .headers .get ('Last-Modified' )} " )
1623
+ logger .debug (
1624
+ f"project_id='{ project_id } ', type=inspection_comment,"
1625
+ f"Last-Modified={ response2 .headers .get ('Last-Modified' )} "
1626
+ )
1618
1627
return url
1619
1628
1620
1629
def download_project_task_history_events_url (self , project_id : str , dest_path : str ) -> str :
@@ -1634,7 +1643,10 @@ def download_project_task_history_events_url(self, project_id: str, dest_path: s
1634
1643
content , _ = self .api .get_project_task_history_events_url (project_id )
1635
1644
url = content ["url" ]
1636
1645
response2 = _download (url , dest_path )
1637
- logger .debug (f"type=task_history_event, Last-Modified={ response2 .headers .get ('Last-Modified' )} " )
1646
+ logger .debug (
1647
+ f"project_id='{ project_id } ', type=task_history_event, "
1648
+ f"Last-Modified={ response2 .headers .get ('Last-Modified' )} "
1649
+ )
1638
1650
return url
1639
1651
1640
1652
def download_project_task_histories_url (self , project_id : str , dest_path : str ) -> str :
@@ -1654,7 +1666,9 @@ def download_project_task_histories_url(self, project_id: str, dest_path: str) -
1654
1666
content , _ = self .api .get_project_task_histories_url (project_id )
1655
1667
url = content ["url" ]
1656
1668
response2 = _download (url , dest_path )
1657
- logger .debug (f"type=task_history, Last-Modified={ response2 .headers .get ('Last-Modified' )} " )
1669
+ logger .debug (
1670
+ f"project_id='{ project_id } ', type=task_history, Last-Modified={ response2 .headers .get ('Last-Modified' )} "
1671
+ )
1658
1672
return url
1659
1673
1660
1674
#########################################
@@ -2068,7 +2082,7 @@ def delete_all_succeeded_job(self, project_id: str, job_type: ProjectJobType) ->
2068
2082
deleted_jobs = []
2069
2083
for job in jobs :
2070
2084
if job ["job_status" ] == "succeeded" :
2071
- logger .debug ("job_id=%s のジョブを削除します。" , job [" job_id" ] )
2085
+ logger .debug (f"project_id=' { project_id } ', job_id=' { job [' job_id' ] } 'のジョブを削除します。" )
2072
2086
self .api .delete_project_job (project_id , job_type = job_type .value , job_id = job ["job_id" ])
2073
2087
deleted_jobs .append (job )
2074
2088
@@ -2188,37 +2202,45 @@ def get_job_from_job_id(arg_job_id: str) -> Optional[ProjectJobInfo]:
2188
2202
# 初回のみ
2189
2203
job = get_latest_job ()
2190
2204
if job is None or job ["job_status" ] != JobStatus .PROGRESS .value :
2191
- logger .debug ("job_type='%s' である進行中のジョブは存在しません。" , job_type .value )
2205
+ logger .debug ("project_id='%s', job_type='%s' である進行中のジョブは存在しません。" , project_id , job_type .value )
2192
2206
return None
2193
2207
job_id = job ["job_id" ]
2194
2208
2195
2209
if job is None :
2196
- logger .debug ("job_id='%s', job_type='%s' のジョブは存在しません。" , job_type .value , job_id )
2210
+ logger .debug (
2211
+ "project_id='%s', job_id='%s', job_type='%s' のジョブは存在しません。" , project_id , job_type .value , job_id
2212
+ )
2197
2213
return None
2198
2214
2199
2215
job_access_count += 1
2200
2216
2201
2217
if job ["job_status" ] == JobStatus .SUCCEEDED .value :
2202
- logger .debug ("job_id='%s', job_type='%s' のジョブが成功しました。" , job_id , job_type .value )
2218
+ logger .debug (
2219
+ "project_id='%s', job_id='%s', job_type='%s' のジョブが成功しました。" , project_id , job_id , job_type .value
2220
+ )
2203
2221
return JobStatus .SUCCEEDED
2204
2222
2205
2223
elif job ["job_status" ] == JobStatus .FAILED .value :
2206
- logger .debug ("job_id='%s', job_type='%s' のジョブが失敗しました。" , job_id , job_type .value )
2224
+ logger .debug (
2225
+ "project_id='%s', job_id='%s', job_type='%s' のジョブが失敗しました。" , project_id , job_id , job_type .value
2226
+ )
2207
2227
return JobStatus .FAILED
2208
2228
2209
2229
else :
2210
2230
# 進行中
2211
2231
if job_access_count < max_job_access :
2212
2232
logger .debug (
2213
- "job_id='%s', job_type='%s' のジョブは進行中です。%d 秒間待ちます。" ,
2233
+ "project_id='%s', job_id='%s', job_type='%s' のジョブは進行中です。%d 秒間待ちます。" ,
2234
+ project_id ,
2214
2235
job_id ,
2215
2236
job_type .value ,
2216
2237
job_access_interval ,
2217
2238
)
2218
2239
time .sleep (job_access_interval )
2219
2240
else :
2220
2241
logger .debug (
2221
- "job_id='%s', job_type='%s' のジョブは %.1f 分以上経過しても、終了しませんでした。" ,
2242
+ "project_id='%s', job_id='%s', job_type='%s' のジョブは %.1f 分以上経過しても、終了しませんでした。" ,
2243
+ project_id ,
2222
2244
job ["job_id" ],
2223
2245
job_type .value ,
2224
2246
job_access_interval * job_access_count / 60 ,
@@ -2407,7 +2429,7 @@ def _to_new_data(labor: Dict[str, Any]) -> Dict[str, Any]:
2407
2429
dt_new_to_date = dt_from_date + datetime .timedelta (days = diff_days // 2 )
2408
2430
dt_new_from_date = dt_new_to_date + datetime .timedelta (days = 1 )
2409
2431
logger .debug (
2410
- " 取得対象の期間が広すぎるため、データを取得できませんでした。"
2432
+ f"project_id=' { project_id } ': 取得対象の期間が広すぎるため、データを取得できませんでした。"
2411
2433
f"取得対象の期間を{ from_date } ~{ dt_new_to_date .strftime (DATE_FORMAT )} , "
2412
2434
f"{ dt_new_from_date .strftime (DATE_FORMAT )} ~{ to_date } に分割して、再度取得します。"
2413
2435
)
0 commit comments