Skip to content

Commit

Permalink
Improve error message when pipeline exists
Browse files Browse the repository at this point in the history
  • Loading branch information
simenheg committed Oct 22, 2024
1 parent 1928f72 commit 96607ec
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions okdata/cli/commands/datasets/wizards.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import sys

from okdata.sdk.data.dataset import Dataset
from okdata.sdk.pipelines.client import PipelineApiClient
from requests import HTTPError

from okdata.cli.command import confirm_to_continue
from okdata.cli.commands.datasets.questions import qs_create_dataset, qs_create_pipeline
Expand Down Expand Up @@ -115,6 +118,14 @@ def __init__(self, command, dataset_id):

def start(self):
choices = run_questionnaire(*qs_create_pipeline())
_create_pipeline(
self.command, self.command.opt("env"), self.dataset_id, choices["pipeline"]
)
try:
_create_pipeline(
self.command,
self.command.opt("env"),
self.dataset_id,
choices["pipeline"],
)
except HTTPError as e:
if e.response.status_code == 409:
sys.exit("This dataset already has a pipeline set up.")
raise

0 comments on commit 96607ec

Please sign in to comment.