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

Change LANGCHAIN_REVISION_ID to revision_id; use git describe as backup; don't overwrite metadata from env variables #365

Merged
merged 5 commits into from
Jan 18, 2024

Conversation

samnoyes
Copy link
Contributor

No description provided.

Copy link
Collaborator

@hinthornw hinthornw left a comment

Choose a reason for hiding this comment

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

This looks alright. 1 request and 1 question

.strip()
.decode()
)
except Exception:
Copy link
Collaborator

@hinthornw hinthornw Jan 18, 2024

Choose a reason for hiding this comment

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

I think we should catch BaseException - include runtime errors and the like


try:
return (
subprocess.check_output(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any reason not to use _exec_git?

@@ -27,4 +27,5 @@
"get_runtime_environment",
"get_system_metrics",
"get_git_info",
"exec_git",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's not export this on the env level (don't want to update our public API). We can still use with other internal files though

return None
except subprocess.CalledProcessError as e:
logger.debug(f"Error running git command: {e}")
except (FileNotFoundError, subprocess.CalledProcessError, BaseException):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could just do BaseException at this point! Captures all cases

@functools.lru_cache(maxsize=1)
def _get_default_revision_id() -> Optional[str]:
"""Get the default revision ID based on `git describe`."""
import subprocess
Copy link
Collaborator

Choose a reason for hiding this comment

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

non longer needed

@hinthornw hinthornw merged commit 72db54b into main Jan 18, 2024
4 checks passed
@hinthornw hinthornw deleted the sam/default-revision-id branch January 18, 2024 23:00
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.

2 participants