Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stream git output during git_clone_project #9149

Merged
merged 1 commit into from
Apr 7, 2023
Merged

Stream git output during git_clone_project #9149

merged 1 commit into from
Apr 7, 2023

Conversation

zanieb
Copy link
Contributor

@zanieb zanieb commented Apr 7, 2023

Displays git output during clones which is helpful for debugging when this fails or for monitoring progress

e.g.

In [1]: from prefect.projects.steps.pull import git_clone_project

In [2]: git_clone_project("prefecthq/prefect")
fatal: repository 'prefecthq/prefect' does not exist
---------------------------------------------------------------------------
CalledProcessError                        Traceback (most recent call last)
Cell In[2], line 1
----> 1 git_clone_project("prefecthq/prefect")

File ~/dev/prefect/src/prefect/projects/steps/pull.py:38, in git_clone_project(repository, branch, access_token)
     35 # Limit git history
     36 cmd += ["--depth", "1"]
---> 38 subprocess.check_call(
     39     cmd, shell=sys.platform == "win32", stderr=sys.stderr, stdout=sys.stdout
     40 )
     41 directory = "/".join(repository.strip().split("/")[-1:]).replace(".git", "")
     42 return {"directory": directory}

File ~/.pyenv/versions/3.11.2/lib/python3.11/subprocess.py:413, in check_call(*popenargs, **kwargs)
    411     if cmd is None:
    412         cmd = popenargs[0]
--> 413     raise CalledProcessError(retcode, cmd)
    414 return 0

CalledProcessError: Command '['git', 'clone', 'prefecthq/prefect', '--depth', '1']' returned non-zero exit status 128.

In [3]: git_clone_project("http://github.com/prefecthq/prefect")
Cloning into 'prefect'...
warning: redirecting to https://github.com/prefecthq/prefect/
remote: Enumerating objects: 1432, done.
remote: Counting objects: 100% (1432/1432), done.
remote: Compressing objects: 100% (1274/1274), done.
remote: Total 1432 (delta 182), reused 699 (delta 93), pack-reused 0
Receiving objects: 100% (1432/1432), 14.65 MiB | 16.43 MiB/s, done.
Resolving deltas: 100% (182/182), done.
Out[3]: {'directory': 'prefect'}

@zanieb zanieb requested a review from a team as a code owner April 7, 2023 18:01
@zanieb zanieb added the enhancement An improvement of an existing feature label Apr 7, 2023
@netlify
Copy link

netlify bot commented Apr 7, 2023

Deploy Preview for prefect-docs-preview ready!

Name Link
🔨 Latest commit 14c5cea
🔍 Latest deploy log https://app.netlify.com/sites/prefect-docs-preview/deploys/64305a8ef7cd190008747a23
😎 Deploy Preview https://deploy-preview-9149--prefect-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Contributor

@serinamarie serinamarie left a comment

Choose a reason for hiding this comment

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

LGTM :)

@zanieb zanieb merged commit 51577d8 into main Apr 7, 2023
@zanieb zanieb deleted the stream-git-clone branch April 7, 2023 18:58
asmundo pushed a commit to asmundo/prefect that referenced this pull request May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants