|
""" Python script that triggers sagemaker flow""" |
|
|
|
import sys |
|
import subprocess |
|
|
|
def main(): |
|
|
|
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() |
|
|