File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
servers/mlflowserver/mlflowserver Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 7
7
import argparse
8
8
import json
9
9
import yaml
10
+ import re
10
11
import tempfile
11
12
from subprocess import run
12
13
from seldon_core .microservice import PARAMETERS_ENV_NAME , parse_parameters
@@ -78,7 +79,16 @@ def inject_base_reqs(env_file_path):
78
79
for dep in conda_env ["dependencies" ]:
79
80
if isinstance (dep , dict ) and "pip" in dep :
80
81
pip_exists = True
81
- dep ["pip" ].append (f"-r { BASE_REQS_PATH } " )
82
+ r = re .compile ("=|>|<| " )
83
+ package_list = [r .split (p )[0 ] for p in dep ["pip" ]]
84
+ with open (BASE_REQS_PATH ) as f :
85
+ for line in f :
86
+ line = line .rstrip ()
87
+ if not line or line .startswith ("#" ):
88
+ continue
89
+ package_name = r .split (line )[0 ]
90
+ if package_name not in package_list :
91
+ dep ["pip" ].append (line )
82
92
break
83
93
if not pip_exists :
84
94
new_entry = {"pip" : [f"-r { BASE_REQS_PATH } " ]}
You can’t perform that action at this time.
0 commit comments