<reponame>ogunnoo/aaw-contrib-containers<gh_stars>1-10
#!/bin/python3

import kfp
# import git
from datetime import datetime

EXPERIMENT = "BTAP ML"
PIPELINE = "Events"


# def short_sha():
#     repo = git.Repo(search_parent_directories=True)
#     sha = repo.head.commit.hexsha
#     return repo.git.rev_parse(sha, short=8)


# COMMIT = short_sha()
TIME = str(datetime.now()).split('.')[0]

#################################
# DON'T EDIT:                 ###
# Create the Experiment       ###
#################################
client = kfp.Client()
client._context_setting['namespace'] ='nrcan-btap'

exp = client.create_experiment(
    name=EXPERIMENT,
    namespace='nrcan-btap'
)

# Create pipeline if not exists
try:
    client.upload_pipeline(
        "pipeline.zip",
        pipeline_name=f"{EXPERIMENT} {PIPELINE}",
        description="BTAP Surrogate model output"
    )
except:
    # Pipeline already exists
    pass

client.upload_pipeline_version(
    "pipeline.zip",
    # pipeline_version_name=f"{TIME} - {COMMIT}",
    pipeline_version_name=f"{TIME}",
    pipeline_name=f"{EXPERIMENT} {PIPELINE}"
)

#############################################
# DON'T EDIT:                             ###
# Run the pipeline                        ###
#############################################

run = client.run_pipeline(
    exp.id,
    EXPERIMENT,
    'pipeline.zip',
)

#!/bin/python3

import kfp
# import git
from datetime import datetime

EXPERIMENT = "BTAP ML"
PIPELINE = "Events"


# def short_sha():
#     repo = git.Repo(search_parent_directories=True)
#     sha = repo.head.commit.hexsha
#     return repo.git.rev_parse(sha, short=8)


# COMMIT = short_sha()
TIME = str(datetime.now()).split('.')[0]

#################################
# DON'T EDIT:                 ###
# Create the Experiment       ###
#################################
client = kfp.Client()
client._context_setting['namespace'] ='nrcan-btap'

exp = client.create_experiment(
    name=EXPERIMENT,
    namespace='nrcan-btap'
)

# Create pipeline if not exists
try:
    client.upload_pipeline(
        "pipeline.zip",
        pipeline_name=f"{EXPERIMENT} {PIPELINE}",
        description="BTAP Surrogate model output"
    )
except:
    # Pipeline already exists
    pass

client.upload_pipeline_version(
    "pipeline.zip",
    # pipeline_version_name=f"{TIME} - {COMMIT}",
    pipeline_version_name=f"{TIME}",
    pipeline_name=f"{EXPERIMENT} {PIPELINE}"
)

#############################################
# DON'T EDIT:                             ###
# Run the pipeline                        ###
#############################################

run = client.run_pipeline(
    exp.id,
    EXPERIMENT,
    'pipeline.zip',
)
#!/bin/python3 # import git # def short_sha(): #     repo = git.Repo(search_parent_directories=True) #     sha = repo.head.commit.hexsha #     return repo.git.rev_parse(sha, short=8) # COMMIT = short_sha() ################################# # DON'T EDIT:                 ### # Create the Experiment       ### ################################# # Create pipeline if not exists # Pipeline already exists # pipeline_version_name=f"{TIME} - {COMMIT}", ############################################# # DON'T EDIT:                             ### # Run the pipeline                        ### #############################################