Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
barberscott committed May 2, 2024
1 parent 2509c5c commit 9ef022e
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions docs/tracing/faq/querying_traces.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -707,44 +707,44 @@ Sometimes, for hygeine or data retrention purposes, you may wish to find and del
import os
import datetime
## Set a delta of 90 days
# Set a delta of 90 days
d = datetime.timedelta(days = 90)
## Determine the current time
# Determine the current time
tod = datetime.datetime.now()
## Determine the timestamp from n days ago
# Determine the timestamp from n days ago
a = tod - d
print('Date Filter is: ' + 'gt(start_time,"' + str(a.strftime('%Y-%m-%dT%H:%M:%SZ')) + '")')
## Initialize the LangSmith SDK
# Initialize the LangSmith SDK
client = Client()
## List projects (uncomment limit and set a limit if you want to test against a smaller number of prjects)
# List projects (uncomment limit and set a limit if you want to test against a smaller number of prjects)
projects = client.list_projects(
# limit=100
)
## Initialize lists
# Initialize lists
processed_projects = []
excluded_projects = []
projects_outdated = []
## Iterate over projects
# Iterate over projects
for p in projects:
found_runs_counter = 0
print('Processing ' + p.name + ' - ' + str(p.id))
## search for traces in the project -- all we need is 1 that meets the critera
# search for traces in the project -- all we need is 1 that meets the critera
traces = client.list_runs(
project_id=p.id,
filter='gt(start_time,"' + str(a) + '")',
is_root=True,
limit=1
)
## process the trace (if returned)
# process the trace (if returned)
for t in traces:
found_runs_counter = found_runs_counter + 1
Expand All @@ -756,11 +756,11 @@ Sometimes, for hygeine or data retrention purposes, you may wish to find and del
break
## if no traces found, append to the list of projects to delete
# if no traces found, append to the list of projects to delete
if found_runs_counter == 0:
projects_outdated.append(p.id)
## append to list of processed projects
# append to list of processed projects
processed_projects.append(p.id)
print('Projects with no Recent Runs:')
Expand Down

0 comments on commit 9ef022e

Please sign in to comment.