Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
metrics-tasks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Legacy
gitolite
metrics-tasks
Commits
0440949c
Commit
0440949c
authored
10 years ago
by
Sreenatha Bhatlapenumarthi
Browse files
Options
Downloads
Patches
Plain Diff
Drop summary document fetch (#9889)
parent
b4ee6de5
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
task-9889/tshirt.py
+5
-14
5 additions, 14 deletions
task-9889/tshirt.py
with
5 additions
and
14 deletions
task-9889/tshirt.py
+
5
−
14
View file @
0440949c
...
...
@@ -43,7 +43,8 @@ def print_debug_info(fingerprint, exit_port_check, uptime_percent, avg_bandwidth
if
exit_port_check
is
False
:
if
avg_bandwidth
>=
500
:
print
(
"
Elligible for T-shirt
"
)
print
(
"
Reason : Average bandwidth greater than 500KBytes/s
"
)
print
(
"
Reason : Average bandwidth greater than 500KBytes/s and
"
"
relay uptime greater than 95%
"
)
else
:
print
(
"
Not elligible for T-shirt
"
)
print
(
"
Reason : Average bandwidth less than 500KBytes/s and port 80 blocked
"
)
...
...
@@ -54,7 +55,7 @@ def print_debug_info(fingerprint, exit_port_check, uptime_percent, avg_bandwidth
else
:
print
(
"
Elligible for T-shirt
"
)
print
(
"
Reason : Average bandwidth greater than 100KBytes/s,
"
"
relay uptime greater than 95% and port 80 unblocked
"
)
"
relay uptime greater than 95% and port 80 unblocked
"
)
print
(
""
)
...
...
@@ -155,20 +156,10 @@ def check_tshirt(search_query):
global
bandwidth_data
global
thread_lock
# Fetch
matching relays from summary document
# Fetch
the required documents from onionoo
params
=
{
'
type
'
:
'
relay
'
,
'
search
'
:
search_query
}
matched_relays
=
fetch_data
(
'
summary
'
,
params
)
print
"
Fetched summary document
"
fingerprints
=
[
i
[
'
f
'
]
for
i
in
matched_relays
[
'
relays
'
]]
if
fingerprints
==
[]:
print
'
No results found
'
exit
()
# Fetch the required documents from onionoo
params
.
pop
(
'
type
'
)
bandwidth_data
=
fetch_data
(
'
bandwidth
'
,
params
)[
'
relays
'
]
print
"
Fetched bandwidth document
"
uptime_data
=
fetch_data
(
'
uptime
'
,
params
)[
'
relays
'
]
...
...
@@ -179,7 +170,7 @@ def check_tshirt(search_query):
# Create and start the threads
threads
=
[]
for
i
in
range
(
len
(
fingerprint
s
)):
for
i
in
range
(
len
(
exit_policie
s
)):
threads
.
append
(
relay_thread
(
i
))
threads
[
-
1
].
start
()
# Wait for the threads to finish
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment