@@ -8,6 +8,7 @@ class MLOps(object):
8
8
spool_dir = "/tmp/ta"
9
9
agent_dir = "/opt/mlops-agent"
10
10
mlops_dir_name = "datarobot_mlops_package-8.1.2"
11
+ total_dir_path = agent_dir + "/" + mlops_dir_name
11
12
12
13
def __init__ (self , api_token , path ):
13
14
self .token = api_token
@@ -29,18 +30,18 @@ def init(self):
29
30
os .environ ['MLOPS_SPOOLER_TYPE' ] = "FILESYSTEM"
30
31
os .environ ['MLOPS_FILESYSTEM_DIRECTORY' ] = self .spool_dir
31
32
32
- with open (f' { self . agent_dir } / { self . mlops_dir_name } /conf/mlops.agent.conf.yaml' ) as f :
33
+ with open (total_dir_path + ' /conf/mlops.agent.conf.yaml' ) as f :
33
34
documents = yaml .load (f , Loader = yaml .FullLoader )
34
35
documents ['mlopsUrl' ] = self .endpoint
35
36
documents ['apiToken' ] = self .token
36
- with open (f' { self . agent_dir } / { self . mlops_dir_name } /conf/mlops.agent.conf.yaml' , 'w' ) as f :
37
+ with open (total_dir_path + ' /conf/mlops.agent.conf.yaml' , 'w' ) as f :
37
38
yaml .dump (documents , f )
38
39
39
- subprocess .call (f' { self . agent_dir } / { self . mlops_dir_name } /bin/start-agent.sh' )
40
- check = subprocess .Popen ([f' { self . agent_dir } / { self . mlops_dir_name } /bin/status-agent.sh' ], stdout = subprocess .PIPE )
40
+ subprocess .call (total_dir_path + ' /bin/start-agent.sh' )
41
+ check = subprocess .Popen ([total_dir_path + ' /bin/status-agent.sh' ], stdout = subprocess .PIPE )
41
42
output = check .stdout .readlines ()[0 ]
42
43
check .terminate ()
43
44
if b"DataRobot MLOps-Agent is running as a service." in output :
44
45
return True
45
46
else :
46
- raise Exception (output )
47
+ raise Exception (output )
0 commit comments