@@ -8,6 +8,7 @@ class MLOps(object):
88 spool_dir = "/tmp/ta"
99 agent_dir = "/opt/mlops-agent"
1010 mlops_dir_name = "datarobot_mlops_package-8.1.2"
11+ total_dir_path = agent_dir + "/" + mlops_dir_name
1112
1213 def __init__ (self , api_token , path ):
1314 self .token = api_token
@@ -29,18 +30,18 @@ def init(self):
2930 os .environ ['MLOPS_SPOOLER_TYPE' ] = "FILESYSTEM"
3031 os .environ ['MLOPS_FILESYSTEM_DIRECTORY' ] = self .spool_dir
3132
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 :
3334 documents = yaml .load (f , Loader = yaml .FullLoader )
3435 documents ['mlopsUrl' ] = self .endpoint
3536 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 :
3738 yaml .dump (documents , f )
3839
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 )
4142 output = check .stdout .readlines ()[0 ]
4243 check .terminate ()
4344 if b"DataRobot MLOps-Agent is running as a service." in output :
4445 return True
4546 else :
46- raise Exception (output )
47+ raise Exception (output )
0 commit comments