Skip to content

Commit

Permalink
Merge pull request #172 from ZJUEarthData/web
Browse files Browse the repository at this point in the history
Web
  • Loading branch information
SanyHe authored Jul 10, 2023
2 parents e8201f6 + 2ecf4e2 commit b26da93
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/geochemistrypy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package

on:
Expand Down Expand Up @@ -28,13 +25,17 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
python -m pip install pre-commit
if [ -f requirements/production.txt ]; then pip install -r requirements/production.txt; fi
- name: Run pre-commit hooks
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --ignore=F811,W605 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=20 --max-line-length=200 --statistics
pre-commit run --all-files
# - name: Lint with flake8
# run: |
# # stop the build if there are Python syntax errors or undefined names
# flake8 . --count --ignore=F811,W605 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=20 --max-line-length=200 --statistics
# - name: Test with pytest
# run: |
# pytest
12 changes: 11 additions & 1 deletion geochemistrypi/data_mining/cli_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,24 @@ def cli_pipeline(file_name: str) -> None:
else:
new_experiment_name = Prompt.ask("✨ New Experiment", default="GeoPi - Rock Classification")
new_experiment_tag = Prompt.ask("✨ Experiment Tag Version", default="E - v1.0.0")
new_experiment_id = mlflow.create_experiment(name=new_experiment_name, artifact_location=artifact_localtion, tags={"version": new_experiment_tag})
try:
new_experiment_id = mlflow.create_experiment(name=new_experiment_name, artifact_location=artifact_localtion, tags={"version": new_experiment_tag})
except mlflow.exceptions.MlflowException as e:
if "already exists" in str(e):
console.print(" The experiment name already exists.", style="bold red")
console.print(" Use the existing experiment.", style="bold red")
console.print(f" '{new_experiment_name}' is activated.", style="bold red")
new_experiment_id = mlflow.get_experiment_by_name(name=new_experiment_name).experiment_id
else:
raise e
experiment = mlflow.get_experiment(experiment_id=new_experiment_id)
# print("Artifact Location: {}".format(experiment.artifact_location))

run_name = Prompt.ask("✨ Run Name", default="Xgboost Algorithm")
run_tag = Prompt.ask("✨ Run Tag Version", default="R - v1.0.0")
run_description = Prompt.ask("✨ Run Description", default="Use xgboost for GeoPi classification.")
mlflow.start_run(run_name=run_name, experiment_id=experiment.experiment_id, tags={"version": run_tag, "description": run_description})
clear_output()

# Data Loading
logger.debug("User Data Uploaded")
Expand Down

0 comments on commit b26da93

Please sign in to comment.