Opened 6 months ago

Closed 6 months ago

Last modified 6 months ago

#34298 closed defect (fixed)

Address networkx's API change, which breaks OnionPerf

Reported by: phw Owned by: phw
Priority: Medium Milestone:
Component: Metrics/Onionperf Version:
Severity: Normal Keywords:
Cc: acute, phw, metrics-team Actual Points: 0.3
Parent ID: Points: 0.1
Reviewer: Sponsor: Sponsor59-must

Description (last modified by phw)

Networkx in version 2.4 deprecated the node attribute of DiGraph and suggests using nodes instead. This breaks OnionPerf but luckily, it's an easy fix.

Here's the error I'm getting on master:

Traceback (most recent call last):
  File "/home/phw/rcs/onionperf/venv/bin/onionperf", line 4, in <module>
    __import__('pkg_resources').run_script('OnionPerf==0.2rc0', 'onionperf')
  File "/home/phw/rcs/onionperf/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 666, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/home/phw/rcs/onionperf/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1453, in run_script
    exec(script_code, namespace, namespace)
  File "/home/phw/rcs/onionperf/venv/lib/python3.7/site-packages/OnionPerf-0.2rc0-py3.7.egg/EGG-INFO/scripts/onionperf", line 529, in <module>
  File "/home/phw/rcs/onionperf/venv/lib/python3.7/site-packages/OnionPerf-0.2rc0-py3.7.egg/EGG-INFO/scripts/onionperf", line 350, in main
  File "/home/phw/rcs/onionperf/venv/lib/python3.7/site-packages/OnionPerf-0.2rc0-py3.7.egg/EGG-INFO/scripts/onionperf", line 401, in measure
  File "/home/phw/rcs/onionperf/venv/lib/python3.7/site-packages/OnionPerf-0.2rc0-py3.7.egg/onionperf/measurement.py", line 239, in run
  File "/home/phw/rcs/onionperf/venv/lib/python3.7/site-packages/OnionPerf-0.2rc0-py3.7.egg/onionperf/measurement.py", line 315, in __start_tgen_client
  File "/home/phw/rcs/onionperf/venv/lib/python3.7/site-packages/OnionPerf-0.2rc0-py3.7.egg/onionperf/measurement.py", line 341, in __start_tgen
  File "/home/phw/rcs/onionperf/venv/lib/python3.7/site-packages/OnionPerf-0.2rc0-py3.7.egg/onionperf/model.py", line 66, in __init__
  File "/home/phw/rcs/onionperf/venv/lib/python3.7/site-packages/OnionPerf-0.2rc0-py3.7.egg/onionperf/model.py", line 74, in generate
AttributeError: 'DiGraph' object has no attribute 'node'

Child Tickets

Change History (8)

comment:1 Changed 6 months ago by phw

Description: modified (diff)
Status: assignedneeds_review

comment:2 Changed 6 months ago by acute

The patch looks good, but the current version of python3-networkx in Debian Stable (what we run in deployment) is 2.2.1, so this would break it.

Maybe we could create a debian-testing branch where we could merge this patch/other bugs we find with newer library versions?

comment:3 Changed 6 months ago by karsten

Status: needs_reviewneeds_revision

I noticed the same issue when setting up an OnionPerf instance on Ubuntu. It would be nice to find a solution that works for 2.2.1 and 2.4.

Is there any way that we can avoid calling g.node or g.nodes? Maybe there's a function for that that hasn't changed its name between 2.2.1 and 2.4? Or maybe we can specify socksproxy when adding the node in the first place? (It's too late for me to try this out today, but I wanted to leave this idea here just in case somebody wants to pick it up.)

comment:4 Changed 6 months ago by karsten

Status: needs_revisionneeds_review

Yesterday night it was too late to write code, but let's hope that now it's not too early in the morning to do that. Please review commit b28d94f in my task-34298 branch with a possible workaround. Tested with version 2.2.1. Would be neat if you could also test it with 2.4 while reviewing it. Thanks!

comment:5 Changed 6 months ago by acute

I've tested this with version 2.4, and can confirm it works there also. Setting to merge_ready and adding my 0.1 points.

comment:6 Changed 6 months ago by acute

Actual Points: 0.1
Status: needs_reviewmerge_ready

comment:7 Changed 6 months ago by karsten

Actual Points: 0.10.3
Resolution: fixed
Status: merge_readyclosed

Awesome! Rebased and pushed to master. Closing. Thanks!

comment:8 Changed 6 months ago by karsten

Sponsor: Sponsor59-must

This was part of Sponsor 59.

Note: See TracTickets for help on using tickets.