File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -604,14 +604,16 @@ def write_to_bento(
604
604
option_line .options .pop ("requirements" , None )
605
605
606
606
if any (
607
- req .name and req .name .lower () == "bentoml"
607
+ req .name and req .name .lower () == "bentoml" and req . link is not None
608
608
for req in requirements_txt .requirements
609
609
):
610
610
has_bentoml_req = True
611
611
612
612
f .write (requirements_txt .dumps (preserve_one_empty_line = True ))
613
613
elif self .packages is not None :
614
- bentoml_req_regex = re .compile (r"^bentoml\b(?![-\._])" , re .IGNORECASE )
614
+ bentoml_req_regex = re .compile (
615
+ r"^bentoml(?:\[[^\]]+\])?\s*@" , re .IGNORECASE
616
+ )
615
617
if any (bentoml_req_regex .match (pkg ) for pkg in self .packages ):
616
618
has_bentoml_req = True
617
619
f .write ("\n " .join (self .packages ) + "\n " )
Original file line number Diff line number Diff line change @@ -212,8 +212,8 @@ def io_cb(x: int):
212
212
fd , tar_name = mkstemp (
213
213
prefix = "bentoml-bento-" , suffix = ".tar" , dir = bentoml_tmp_dir
214
214
)
215
+ tar_io = os .fdopen (fd , "wb+" )
215
216
try :
216
- tar_io = os .fdopen (fd , "wb+" )
217
217
with self .spinner .spin (
218
218
text = f'Creating tar archive for bento "{ bento .tag } "..'
219
219
):
@@ -403,7 +403,7 @@ def chunk_upload(
403
403
self .spinner .log (f'[bold green]Successfully pushed Bento "{ bento .tag } "' )
404
404
finally :
405
405
try :
406
- os .close (fd )
406
+ tar_io .close ()
407
407
except OSError :
408
408
pass
409
409
os .unlink (tar_name )
Original file line number Diff line number Diff line change @@ -158,8 +158,8 @@ def io_cb(x: int):
158
158
fd , tar_name = mkstemp (
159
159
prefix = "bentoml-model-" , suffix = ".tar" , dir = bentoml_tmp_dir
160
160
)
161
+ tar_io = os .fdopen (fd , "wb+" )
161
162
try :
162
- tar_io = os .fdopen (fd , "wb+" )
163
163
with self .spinner .spin (
164
164
text = f'Creating tar archive for model "{ model .tag } "..'
165
165
):
@@ -342,7 +342,7 @@ def chunk_upload(
342
342
self .spinner .log (f'[bold green]Successfully pushed model "{ model .tag } "' )
343
343
finally :
344
344
try :
345
- os .close (fd )
345
+ tar_io .close ()
346
346
except OSError :
347
347
pass
348
348
os .unlink (tar_name )
You can’t perform that action at this time.
0 commit comments