File size: 592 Bytes
e417b0c
 
 
 
 
 
 
8f5c8b8
 
6e0a1d3
 
 
 
 
2786d7b
6e0a1d3
 
 
e417b0c
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
""" Python script that triggers sagemaker flow"""

import sys
import subprocess

def main():
    # Let's skip arg names
    script_name = sys.argv[2]
    repo = sys.argv[4]
    repo_name = repo.split('/')[-1] + '/'
    cmd = f'git clone {repo}'
    print("Running", cmd)
    output1 = subprocess.run(cmd.split(), stdout=subprocess.PIPE)
    print(output1.stdout.decode())
    cmd = f'sh {repo_name}/{script_name} {repo_name}'
    print("Running", cmd)
    output2 = subprocess.run(cmd.split(), stdout=subprocess.PIPE)
    print(output2.stdout.decode())

if __name__ == '__main__':
    main()