onbasca.onbasca.models package¶
Submodules¶
onbasca.onbasca.models.bwfile module¶
- class onbasca.onbasca.models.bwfile.BwFile(id, _obj_created_at, _obj_updated_at, file_created, latest_bandwidth, scanner_country, software, software_version, tor_version, consensus, destinations_countries, earliest_bandwidth, generator_started, minimum_number_eligible_relays, minimum_percent_eligible_relays, number_consensus_relays, number_eligible_relays, percent_eligible_relays, recent_consensus_count, recent_priority_list_count, recent_priority_relay_count, recent_measurement_attempt_count, recent_measurement_failure_count, recent_measurements_excluded_error_count, recent_measurements_excluded_near_count, recent_measurements_excluded_few_count, recent_measurements_excluded_old_count, time_to_report_half_network, version, _mu, _muf, _bw_sum, _bw_scaled_sum, _limit, _bw_scaled_limited_sum, _bw_scaled_limited_rounded_sum, _heartbeat)[source]¶
Bases:
BwFileBase
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- clean()[source]¶
Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.
- consensus¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- consensus_id¶
- consensus_weight_percent_diff()[source]¶
Return the percentage difference between the consensus weight sum and this Bandwidth file weight sum.
- destinations_countries¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- earliest_bandwidth¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- file_created¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- generator_started¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_consensus_weight_percent_diff_greater_maximum()[source]¶
Return True and log a warning if the percentage difference between the consensus weight sum and this Bandwidth File weight sum is greater than a maximum.
Avoids sbws#40115.
- is_min_percent_relays_to_report()[source]¶
Return True if the minimum percentage of measured relays with respect to the consensus has been reached and False otherwise.
- is_min_percent_relays_to_report_reached_before()[source]¶
Return True if the minimum percentage of measured relays with respect to the consensus was reached before and False otherwise.
- latest_bandwidth¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- minimum_number_eligible_relays¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- minimum_percent_eligible_relays¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- number_consensus_relays¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- number_eligible_relays¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <onbasca.onbasca.models.bwfile.BwFileManager object>¶
- percent_eligible_relays¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- recent_consensus_count¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- recent_measurement_attempt_count¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- recent_measurement_failure_count¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- recent_measurements_excluded_error_count¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- recent_measurements_excluded_few_count¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- recent_measurements_excluded_near_count¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- recent_measurements_excluded_old_count¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- recent_priority_list_count¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- recent_priority_relay_count¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- relaybw_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- scanner_country¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- set_relaybws_under_min_to_report()[source]¶
Modify the Bandwidth Lines adding the KeyValue under_min_report, vote.
Future version: this should probably be eliminated. It only has happened when the scanner has been running for very few days.
- software¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- software_version¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- time_to_report_half_network¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- tor_version¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- version¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class onbasca.onbasca.models.bwfile.BwFileManager(*args, **kwargs)[source]¶
Bases:
BwFileManagerBase
- generate()[source]¶
https://gitlab.torproject.org/tpo/network-health/sbws/-/issues/29710, https://gitlab.torproject.org/tpo/network-health/sbws/-/issues/40006, https://gitlab.torproject.org/tpo/network-health/sbws/-/issues/40023, https://gitlab.torproject.org/tpo/network-health/sbws/-/issues/40049, https://gitlab.torproject.org/tpo/network-health/sbws/-/issues/40017: Report relays and measurements using config.OLDEST_DATA_DAYS (28 by default) days of measurements and config.RECENT_DAYS (5 by default for the recent KeyValues).
onbasca.onbasca.models.consensus module¶
- class onbasca.onbasca.models.consensus.Consensus(_obj_created_at, _obj_updated_at, valid_after, _exits_min_bandwidth, _exits_min_position, _non_exits_min_bandwidth, _non_exits_min_position, _cc_alg_2, _bwscanner_cc_gte_1, _bridge_ratio)[source]¶
Bases:
ConsensusBase
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- async aset_fast_stable_uptime_non_exits_fingerprints(uptime=151, min_middle_count=10, max_middle_count=30)[source]¶
- bwfile_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- exits_with_bandwidth_fingerprints(routerstatus)[source]¶
Return the exits with bandwidth greater than minimum.
After calculating the lowest bandwidth for exits.
- get_next_by_valid_after(*, field=<django.db.models.fields.DateTimeField: valid_after>, is_next=True, **kwargs)¶
- get_previous_by_valid_after(*, field=<django.db.models.fields.DateTimeField: valid_after>, is_next=False, **kwargs)¶
- measurement_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- non_exits_with_bandwidth_fingerprints(routerstatus)[source]¶
Return the non exits with bandwidth greater than minimum.
After calculating the lowest bandwidth for non exits.
- objects = <onbasca.onbasca.models.consensus.ConsensusManager object>¶
- relay_set¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- routerstatus_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- routerstatuses_ordered()[source]¶
https://gitlab.torproject.org/tpo/network-health/sbws/-/issues/34393: Measure first relays without measurements.
- set_exits_fingerprints(testing_network=False)[source]¶
Create a list with exits fingerprints.
To later calculate the minimum bandwidth the exits must have.
- set_exits_min_bandwidth()[source]¶
Calculate and set the minimum bandwidth for exits.
Ordering the exits by bandwidth, obtain the lowest bandwidth after ignoring the first 25% percent of slower exits, using the minimum position calculated by
set_exits_min_position()
.Avoids https://gitlab.torproject.org/tpo/network-health/sbws/-/issues/33009 # noqa
- set_exits_min_position()[source]¶
Calculate 1/4 of the exits and and pick that position.
To later calculate and set in
set_exits_min_bandwidth()
what’s the lowest bandwidth for an exit, ignoring the 25% with lower bandwidth.
- set_non_exits_fingerprints(testing_network=False)[source]¶
Create a list with non exits fingerprints.
To later calculate the minimum bandwidth the non exits must have.
- set_non_exits_min_bandwidth()[source]¶
Calculate and set the minimum bandwidth for non exits.
Ordering the non exits by bandwidth, obtain the lowest bandwidth after ignoring the first 25% percent of slower non exits.
Avoids https://gitlab.torproject.org/tpo/network-health/sbws/-/issues/33009 # noqa
- set_non_exits_min_position()[source]¶
Calculate 1/4 of the non exits and pick that position.
To later calculate and set what’s the lowest bandwidth for an non exit, ignoring the 25% with lower bandwidth.
- valid_after¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class onbasca.onbasca.models.consensus.ConsensusManager(*args, **kwargs)[source]¶
Bases:
ConsensusManagerBase
onbasca.onbasca.models.heartbeat module¶
- class onbasca.onbasca.models.heartbeat.Heartbeat(id, _obj_created_at, _obj_updated_at, loops_count, measured_count, measured_percent, previous_measured_percent, elapsed_time, _min_percent_relays_to_report_reached_at)[source]¶
Bases:
BaseModel
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- bwfile_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- elapsed_time¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- log_status()[source]¶
Print the new percentage of the different relays that were measured.
This way it can be known whether the scanner is making progress measuring all the Network.
Log the percentage, the number of relays measured and not measured, the number of loops and the time elapsed since it started measuring.
- loops_count¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- measured_count¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- measured_percent¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- previous_measured_percent¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- scanner¶
Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
onbasca.onbasca.models.measurement module¶
- class onbasca.onbasca.models.measurement.Measurement(id, _obj_created_at, _obj_updated_at, consensus, created_at, queued_at, attempted_at, finished_at, relay, webserver, helper, as_exit, bandwidth, error)[source]¶
Bases:
Model
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- as_exit¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- attempted_at¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- bandwidth¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- consensus¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- consensus_id¶
- created_at¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- error¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- finished_at¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)¶
- get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)¶
- helper¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- helper_id¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <onbasca.onbasca.models.measurement.MeasurementManager object>¶
- queued_at¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- relay¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- relay_id¶
Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
- routerstatus_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- webserver¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- webserver_id¶
onbasca.onbasca.models.relay module¶
- class onbasca.onbasca.models.relay.Relay(*args, **kwargs)[source]¶
Bases:
RelayBase
- Torflow::
dead = not (“Running” in ns.flags)
- elif kw == “opt hibernating”:
dead = True
- if not bw_observed and not dead and (“Valid” in ns.flags):
dead = True
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- property consensus_bandwidth¶
- property consensus_bandwidth_is_unmeasured¶
- consensuses¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- property desc_bw_avg¶
- property desc_bw_bur¶
- property desc_bw_obs_last¶
- property desc_bw_obs_mean¶
- property error_circ¶
- property error_misc¶
- property error_second_relay¶
- property error_stream¶
- fingerprint¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- helper¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- property master_key_ed25519¶
- property measured_at¶
- measurements¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- property nickname¶
- objects = <onbasca.onbasca.models.relay.RelayManager object>¶
- relaybw_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- relaydesc_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- routerstatus_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- set_bw_filt()[source]¶
https://gitlab.torproject.org/tpo/network-health/sbws/-/issues/40059, https://gitlab.torproject.org/tpo/network-health/sbws/-/issues/40080: Calculate bw stream and filtered without distinguishig relay types.
- set_bw_scaled()[source]¶
https://gitlab.torproject.org/tpo/network-health/sbws/-/issues/30274, https://gitlab.torproject.org/tpo/network-health/sbws/-/issues/40088, https://gitlab.torproject.org/tpo/network-health/sbws/-/issues/40075, https://gitlab.torproject.org/tpo/network-health/sbws/-/issues/40014, https://gitlab.torproject.org/tpo/network-health/sbws/-/issues/40091: solved by using relay descriptors’ bandwidth but no consensus weight.
- property success¶
- class onbasca.onbasca.models.relay.RelayManager(*args, **kwargs)[source]¶
Bases:
RelayManagerBase
onbasca.onbasca.models.relaybw module¶
- class onbasca.onbasca.models.relaybw.RelayBw(id, _obj_created_at, _obj_updated_at, fingerprint, measured_at, updated_at, nickname, bw, consensus_bandwidth, consensus_bandwidth_is_unmeasured, desc_bw_avg, desc_bw_bur, desc_bw_obs_last, error_circ, error_stream, success, vote, under_min_report, bwfile, relay, bw_mean, bw_median, desc_bw_obs_mean, error_destination, error_misc, error_second_relay, master_key_ed25519, time, unmeasured, scanner, relay_in_recent_consensus_count, relay_recent_priority_list_count, relay_recent_measurement_attempt_count, relay_recent_measurement_failure_count, relay_recent_measurements_excluded_error_count, _bw_filt, _ratio_stream, _ratio_filt, _ratio, _bw_scaled, _bw_scaled_limited, _bw_scaled_limited_rounded)[source]¶
Bases:
RelayBwBase
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- bw¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- bw_mean¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- bw_median¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- bwfile¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- bwfile_id¶
- clean()[source]¶
Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.
- consensus_bandwidth¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- consensus_bandwidth_is_unmeasured¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- desc_bw_avg¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- desc_bw_bur¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- desc_bw_obs_last¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- desc_bw_obs_mean¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- error_circ¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- error_destination¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- error_misc¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- error_second_relay¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- error_stream¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- fingerprint¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- master_key_ed25519¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- measured_at¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- nickname¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <onbasca.onbasca.models.relaybw.RelayBwManager object>¶
- relay¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- relay_id¶
- relay_in_recent_consensus_count¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- relay_recent_measurement_attempt_count¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- relay_recent_measurement_failure_count¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- relay_recent_measurements_excluded_error_count¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- relay_recent_priority_list_count¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- scanner¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- set_under_min_report()[source]¶
Set
vote
andunmeasured
KeyValues.From [BandwidthFile]
generator implementations MUST NOT change the bandwidths for under_min_report relays. Using the same bw value makes authorities that do not understand "vote=0" or "under_min_report=1" produce votes that don't change relay weights too much. It also avoids flapping when the reporting threshold is reached.
- set_vote()[source]¶
Set
vote
andunmeasured
KeyValues.From [BandwidthFile]
generator implementations MUST set "bw=1" for unmeasured relays. Using the minimum bw value makes authorities that do not understand "vote=0" or "unmeasured=1" produce votes that don't change relay weights too much.
- success¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- time¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- under_min_report¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- unmeasured¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- updated_at¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- vote¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class onbasca.onbasca.models.relaybw.RelayBwManager(*args, **kwargs)[source]¶
Bases:
RelayBwManagerBase
- from_relay(relay, now=None)[source]¶
https://gitlab.torproject.org/tpo/network-health/sbws/-/issues/34444, https://gitlab.torproject.org/tpo/network-health/sbws/-/issues/34309, others: relay_recent KeyValues are updated correctly since their values come from the DB and not queues of timestamps.
onbasca.onbasca.models.relaydesc module¶
- class onbasca.onbasca.models.relaydesc.RelayDesc(id, _obj_created_at, _obj_updated_at, fingerprint, published, ed25519_master_key, nickname, observed_bandwidth, average_bandwidth, burst_bandwidth, _min_bandwidth, can_exit_443, _can_exit_443_strict, _can_exit_v6_443, _uptime, relay, _hibernating, overload_general, overload_ratelimits, overload_fd_exhausted, _flowctrl_2)[source]¶
Bases:
RelayDescBase
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- average_bandwidth¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- burst_bandwidth¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- can_exit_443¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- ed25519_master_key¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- fingerprint¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- nickname¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <onbasca.onbasca.models.relaydesc.RelayDescManager object>¶
- observed_bandwidth¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- overload_fd_exhausted¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- overload_general¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- overload_ratelimits¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- published¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- relay¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- relay_id¶
onbasca.onbasca.models.routerstatus module¶
- class onbasca.onbasca.models.routerstatus.RouterStatus(*args, **kwargs)[source]¶
Bases:
RouterStatusBase
Torflow:
# Routers can fall out of our consensus five different ways: # 1. Their descriptors disappear # 2. Their NS documents disappear # 3. They lose the Running flag # 4. They list a bandwidth of 0 # 5. They have 'opt hibernating' set routers = self.c.read_routers(nslist) # Sets .down if 3,4,5 # down = dead removed_idhexes.update(set(map(lambda r: r.idhex, filter(lambda r: r.down, routers)))) for i in removed_idhexes: if i not in self.routers: continue self.routers[i].down = True if "Running" in self.routers[i].flags: self.routers[i].flags.remove("Running") if self.routers[i].refcount == 0: self.routers[i].deleted = True else: self.routers[i].deleted = True
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- address¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- bandwidth¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- consensus¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- consensus_id¶
- fingerprint¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- helper_path()[source]¶
https://gitlab.torproject.org/tpo/network-health/sbws/-/issues/40041: do not measure non-exit as exits.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_exit¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_unmeasured¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- nickname¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <onbasca.onbasca.models.routerstatus.RouterStatusManager object>¶
- published¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- relay¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- relay_id¶
onbasca.onbasca.models.scanner module¶
- class onbasca.onbasca.models.scanner.Scanner(*args, **kwargs)[source]¶
Bases:
Model
Singleton class that manages the measurer threads.
And initializes all the needed objects.
https://gitlab.torproject.org/tpo/network-health/sbws/-/issues/40092, https://gitlab.torproject.org/tpo/network-health/sbws/-/issues/40084, https://gitlab.torproject.org/tpo/network-health/sbws/-/issues/40087: solved by using concurrent.futures.
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- elapsed_time¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_next_by_started_at(*, field=<django.db.models.fields.DateTimeField: started_at>, is_next=True, **kwargs)¶
- get_previous_by_started_at(*, field=<django.db.models.fields.DateTimeField: started_at>, is_next=False, **kwargs)¶
- heartbeat¶
Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
- heartbeat_id¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- nickname¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- queue_future_measurements()[source]¶
https://gitlab.torproject.org/tpo/network-health/sbws/-/issues/40037: solved by measuring only the relays in the consensus.
- save(*args, **kwargs)[source]¶
Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
- started_at¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- tor_version¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- uuid¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
onbasca.onbasca.models.webserver module¶
- class onbasca.onbasca.models.webserver.WebServer(id, _obj_created_at, _obj_updated_at, url, enabled, verify)[source]¶
Bases:
Model
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- bridgemeasurement_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- enabled¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- measurement_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- objects = <onbasca.onbasca.models.webserver.WebServerManager object>¶
- url¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- verify¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.