15
15
16
16
class CMInit ():
17
17
###############################################################
18
- def run (self , quiet = False , repo_name = 'mlcommons@cm4mlops' , repo_branch = '' ):
18
+ def run (self , quiet = False , skip = False , repo_name = 'mlcommons@cm4mlops' , repo_url = ' ' , repo_branch = '' ):
19
19
import cmind
20
20
21
21
print ('Checking platform information ...' )
@@ -27,19 +27,29 @@ def run(self, quiet = False, repo_name = 'mlcommons@cm4mlops', repo_branch = '')
27
27
if r ['return' ]> 0 or r .get ('warning' ,'' ) != '' :
28
28
return r
29
29
30
- print ('' )
31
- print ('Obtaining default automation repository ...' )
30
+ rr = {'return' :0 }
32
31
33
- print ('' )
34
- ii = {'action' :'pull' ,
35
- 'automation' :'repo' ,
36
- 'artifact' :repo_name ,
37
- 'out' :'con' }
32
+ if not skip :
33
+
34
+ print ('' )
35
+ print ('Pulling default automation repository ...' )
36
+
37
+ print ('' )
38
+ ii = {'action' :'pull' ,
39
+ 'automation' :'repo' ,
40
+ 'out' :'con' }
41
+
42
+ if repo_url != '' :
43
+ ii ['url' ] = repo_url
44
+ elif repo_name != '' :
45
+ ii ['artifact' ] = repo_name
46
+
47
+ if repo_branch != '' :
48
+ ii ['branch' ] = repo_branch
38
49
39
- if repo_branch != '' :
40
- ii ['branch' ] = repo_branch
50
+ rr = cmind .access (ii )
41
51
42
- return cmind . access ( ii )
52
+ return rr
43
53
44
54
###############################################################
45
55
def install_system_packages (self , quiet ):
@@ -215,9 +225,10 @@ def init(self, i):
215
225
(CM input dict):
216
226
217
227
(quiet) (bool): if True, skip asking questions about sudo, etc
218
- (repo) (str): automation repository to pull ('mlcommons@cm4mlops' by default)
228
+ (repo) (str): main automation repository to pull ('mlcommons@cm4mlops' by default)
229
+ (url) (str): main automation repository to pull via url (can use git@ instead of https)
219
230
(branch) (str): branch to use ('' by default)
220
-
231
+ (skip) (bool): skip pulling main automation repository
221
232
222
233
Returns:
223
234
(CM return dict):
@@ -230,12 +241,16 @@ def init(self, i):
230
241
231
242
quiet = i .get ('quiet' , False )
232
243
233
- repo_name = i .get ('repo' , '' )
234
- if repo_name == '' : repo_name = 'mlcommons@cm4mlops'
244
+ skip = i .get ('skip' , False )
245
+
246
+ repo_name = i .get ('repo' , '' ).strip ()
247
+ repo_url = i .get ('url' , '' ).strip ()
248
+ if repo_url == '' and repo_name == '' :
249
+ repo_name = 'mlcommons@cm4mlops'
235
250
236
251
repo_branch = i .get ('branch' , '' )
237
252
238
- r = cm_init .run (quiet = quiet , repo_name = repo_name , repo_branch = repo_branch )
253
+ r = cm_init .run (quiet = quiet , skip = skip , repo_name = repo_name , repo_url = repo_url , repo_branch = repo_branch )
239
254
if r ['return' ]> 0 : return r
240
255
241
256
warning = r .get ('warning' , '' )
0 commit comments