Skip to content

Conversation

@bglearning
Copy link
Contributor

@bglearning bglearning commented Dec 3, 2025

Related Issues

Proposed Changes?

Previously, in #283, we updated the pipeline import to fetch the latest pipeline version and patch that.

Instead, we want the following behavior:

  • First try to fetch the latest version.
  • If the pipeline doesn't exist (404), create it instead.
  • If the latest version is a draft (is_draft == True), PATCH that version.
  • Otherwise, create a new version via POST /pipelines/{name}/versions.

How did you test it?

Changes in unit and integration tests.
And tried out via the import script.

Checklist

  • I have updated the referenced issue with new insights and changes
  • If this is a code change, I have added unit tests
  • I've used the conventional commit specification for my PR title
  • I updated the docstrings
  • If this is a code change, I added meaningful logs and prepared Datadog visualizations and alerts

@bglearning bglearning force-pushed the update-import-pipeline branch from 30d0476 to 4f8eb80 Compare December 4, 2025 06:54
@github-actions
Copy link

github-actions bot commented Dec 4, 2025

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  deepset_cloud_sdk/_service
  pipeline_service.py 395
Project Total  

This report was generated by python-coverage-comment-action

@bglearning bglearning marked this pull request as ready for review December 5, 2025 08:59
@bglearning bglearning requested a review from a team as a code owner December 5, 2025 08:59
abrahamy
abrahamy previously approved these changes Dec 5, 2025
Comment on lines +396 to +399
version_body = version_response.json()
latest_version = version_body["data"][0]
version_id = latest_version["version_id"]
is_draft = latest_version.get("is_draft", False)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are assuming the response is a valid response without checking. If we get another status code like, say, 401 or 403 these lines may raise an error.

Instead let's do the following:

import httpx

try:
    version_response = await sef._api.get(...)
    version_response.raise_for_status()
except httpx.HTTPStatusError as e:
    if e.response.status_code != HTTPStatus.NOT_FOUND:
        raise
     # the pipeline does not exist, let's create it.
     return await self._api.create_pipeline(...)

# pass the response
version_body = ...

if is_draft:
    # do draft things
    return

# do non-draft things

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @abrahamy Updated this accordingly.

@abrahamy abrahamy dismissed their stale review December 5, 2025 10:48

See comment above.

@bglearning bglearning requested a review from abrahamy December 5, 2025 11:24
@abrahamy abrahamy added this pull request to the merge queue Dec 5, 2025
Merged via the queue into main with commit ac34c63 Dec 5, 2025
7 checks passed
@abrahamy abrahamy deleted the update-import-pipeline branch December 5, 2025 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pipeline overwrite should likely create a new version

3 participants