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

READY: Implemented endpoint to start a download from infohash #2338

Closed
wants to merge 4 commits into from

Conversation

devos50
Copy link
Contributor

@devos50 devos50 commented Jun 25, 2016

No description provided.

@devos50
Copy link
Contributor Author

devos50 commented Jun 26, 2016

(test seems to hang?)

@devos50
Copy link
Contributor Author

devos50 commented Jun 26, 2016

retest this please

@devos50 devos50 force-pushed the start_download_infohash branch 2 times, most recently from 52cbd00 to f7130dd Compare June 26, 2016 10:43
@whirm
Copy link

whirm commented Jun 27, 2016

retest this please

@devos50
Copy link
Contributor Author

devos50 commented Jun 28, 2016

@lfdversluis ready for your review

@lfdversluis
Copy link

Looks good to me.

@devos50
Copy link
Contributor Author

devos50 commented Jun 28, 2016

@lfdversluis I'm thinking about adding some parameters for anonymous downloading/seeding + destination on disk so I will work on that first (was a little to fast to ask you for review ;)

@devos50 devos50 force-pushed the start_download_infohash branch 2 times, most recently from 88deea5 to a83c596 Compare June 29, 2016 17:06
@devos50
Copy link
Contributor Author

devos50 commented Jun 29, 2016

retest this please

@devos50
Copy link
Contributor Author

devos50 commented Jun 29, 2016

See #2363

@devos50
Copy link
Contributor Author

devos50 commented Jun 29, 2016

retest this please

@devos50
Copy link
Contributor Author

devos50 commented Jun 29, 2016

Tests on mac timed out

@devos50
Copy link
Contributor Author

devos50 commented Jun 29, 2016

retest this please

@synctext
Copy link
Member

retest this please

1 similar comment
@devos50
Copy link
Contributor Author

devos50 commented Jun 30, 2016

retest this please

@devos50
Copy link
Contributor Author

devos50 commented Jul 1, 2016

The error encountered here is probably fixed by #2392

download_config = DownloadStartupConfig()

has_anon_download = 'anon_download' in parameters and len(parameters['anon_download']) > 0
has_safe_seeding = 'safe_seeding' in parameters and len(parameters['safe_seeding']) > 0
Copy link
Contributor Author

Choose a reason for hiding this comment

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

(Laurens): If now someone specifies (anon_download = false), then your code will think it's true. This is more a flag based approach than an argument based approach.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@whirm do you know the best way to make it a flag?

Copy link

Choose a reason for hiding this comment

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

@devos50 I'll come to your office later to talk about this

@devos50
Copy link
Contributor Author

devos50 commented Jul 7, 2016

retest this please

@devos50
Copy link
Contributor Author

devos50 commented Jul 7, 2016

Job got aborted halfway?

@devos50
Copy link
Contributor Author

devos50 commented Jul 7, 2016

retest this please

@devos50
Copy link
Contributor Author

devos50 commented Jul 7, 2016

Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/Users/tribler/Documents/workspace/workspace/GH_Tribler_PR_tests_mac/tribler/Tribler/Core/Utilities/twisted_thread.py", line 55, in _reactor_runner
    reactor.run(installSignalHandlers=False)
  File "/usr/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1194, in run
    self.mainLoop()
  File "/usr/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1203, in mainLoop
    self.runUntilCurrent()
--- <exception caught here> ---
  File "/usr/local/lib/python2.7/site-packages/twisted/internet/base.py", line 825, in runUntilCurrent
    call.func(*call.args, **call.kw)
  File "/Users/tribler/Documents/workspace/workspace/GH_Tribler_PR_tests_mac/tribler/Tribler/Core/Libtorrent/__init__.py", line 27, in <lambda>
    lambda_f = lambda a = args, kwa = kwargs: invoke_func(*a, **kwa)
  File "/Users/tribler/Documents/workspace/workspace/GH_Tribler_PR_tests_mac/tribler/Tribler/Core/Libtorrent/__init__.py", line 28, in invoke_func
    download.session.lm.threadpool.add_task(lambda_f, 1)
exceptions.AttributeError: 'NoneType' object has no attribute 'add_task'

@devos50
Copy link
Contributor Author

devos50 commented Jul 7, 2016

retest this please

1 similar comment
@brussee
Copy link
Member

brussee commented Jul 7, 2016

retest this please

@devos50
Copy link
Contributor Author

devos50 commented Jul 8, 2016

test_ffsearch (Tribler.Test.test_remote_search.TestMixedRemoteSearch) ... Unhandled Error
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/jenkins/workspace/GH_Tribler_PR_tests_linux@2/tribler/Tribler/Core/Utilities/twisted_thread.py", line 55, in _reactor_runner
    reactor.run(installSignalHandlers=False)
  File "/usr/lib/python2.7/dist-packages/twisted/internet/base.py", line 1194, in run
    self.mainLoop()
  File "/usr/lib/python2.7/dist-packages/twisted/internet/base.py", line 1203, in mainLoop
    self.runUntilCurrent()
--- <exception caught here> ---
  File "/usr/lib/python2.7/dist-packages/twisted/internet/base.py", line 825, in runUntilCurrent
    call.func(*call.args, **call.kw)
  File "<string>", line 2, in _do_request

  File "/home/jenkins/workspace/GH_Tribler_PR_tests_linux@2/tribler/Tribler/Core/RemoteTorrentHandler.py", line 32, in pass_when_stopped
    return f(self, *argv, **kwargs)
  File "/home/jenkins/workspace/GH_Tribler_PR_tests_linux@2/tribler/Tribler/Core/RemoteTorrentHandler.py", line 455, in _do_request
    trackers = self._torrent_db_handler.getTrackerListByInfohash(infohash)
  File "/home/jenkins/workspace/GH_Tribler_PR_tests_linux@2/tribler/Tribler/Core/CacheDB/SqliteCacheDBHandler.py", line 696, in getTrackerListByInfohash
    torrent_id = self.getTorrentID(infohash)
  File "/home/jenkins/workspace/GH_Tribler_PR_tests_linux@2/tribler/Tribler/Core/CacheDB/SqliteCacheDBHandler.py", line 242, in getTorrentID
    return self.getTorrentIDS([infohash, ]).get(infohash)
  File "/home/jenkins/workspace/GH_Tribler_PR_tests_linux@2/tribler/Tribler/Core/CacheDB/SqliteCacheDBHandler.py", line 262, in getTorrentIDS
    torrents = self._db.fetchall(sql_stmt, to_select)
  File "/home/jenkins/workspace/GH_Tribler_PR_tests_linux@2/tribler/Tribler/dispersy/util.py", line 46, in helper
    return blockingCallFromThread(reactor, func, *args, **kargs)
  File "/home/jenkins/workspace/GH_Tribler_PR_tests_linux@2/tribler/Tribler/dispersy/util.py", line 225, in blockingCallFromThread
    return f(*args, **kwargs)
  File "/home/jenkins/workspace/GH_Tribler_PR_tests_linux@2/tribler/Tribler/Core/CacheDB/sqlitecachedb.py", line 401, in fetchall
    res = self.execute_read(sql, args)
  File "/home/jenkins/workspace/GH_Tribler_PR_tests_linux@2/tribler/Tribler/Core/CacheDB/sqlitecachedb.py", line 310, in execute_read
    return self.execute(sql, args)
  File "/home/jenkins/workspace/GH_Tribler_PR_tests_linux@2/tribler/Tribler/dispersy/util.py", line 46, in helper
    return blockingCallFromThread(reactor, func, *args, **kargs)
  File "/home/jenkins/workspace/GH_Tribler_PR_tests_linux@2/tribler/Tribler/dispersy/util.py", line 225, in blockingCallFromThread
    return f(*args, **kwargs)
  File "/home/jenkins/workspace/GH_Tribler_PR_tests_linux@2/tribler/Tribler/Core/CacheDB/sqlitecachedb.py", line 263, in execute
    cur = self.get_cursor()
  File "/home/jenkins/workspace/GH_Tribler_PR_tests_linux@2/tribler/Tribler/Core/CacheDB/sqlitecachedb.py", line 196, in get_cursor
    self._cursor_table[thread_name] = self._connection.cursor()
exceptions.AttributeError: 'NoneType' object has no attribute 'cursor'

@devos50
Copy link
Contributor Author

devos50 commented Jul 8, 2016

retest this please

@devos50
Copy link
Contributor Author

devos50 commented Jul 8, 2016

This one is too unstable too be merged at the moment due to the thread pool stuff when checkpointing (this is probably since I'm starting downloads in the tests I've added).

@whirm
Copy link

whirm commented Jul 8, 2016

I'm working on removing the threadpool altogether, but I'm finding so many bugs while doing it that I spend most of the time fixing them so I can go on.

@brussee
Copy link
Member

brussee commented Jul 8, 2016

retest this please

@brussee
Copy link
Member

brussee commented Jul 8, 2016

@whirm @devos50 Smooth sailing now! Ready to merge?

@devos50
Copy link
Contributor Author

devos50 commented Jul 10, 2016

@brussee I understand you need this endpoint but I'm afraid that if we merge this endpoint, the tests will become too unstable. Also, I first want a review from @whirm ;)

@devos50 devos50 changed the title WIP: Implemented endpoint to start a download from infohash READY: Implemented endpoint to start a download from infohash Jul 10, 2016
@devos50
Copy link
Contributor Author

devos50 commented Jul 10, 2016

@whirm can you review?

.. sourcecode:: none

curl -X PUT http://localhost:8085/download/4344503b7e797ebf31582327a5baae35b11bda01
--data "anon_download=true&safe_seeding=true&destination=/my/dest/on/disk/"
Copy link

Choose a reason for hiding this comment

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

We talked about using the hop number instead (0 hops being plain download)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@whirm ah I forgot to update the doc string here. Is that your only comment regarding this PR? :)

@devos50
Copy link
Contributor Author

devos50 commented Jul 12, 2016

retest this please

@devos50
Copy link
Contributor Author

devos50 commented Jul 12, 2016

success :)

@devos50
Copy link
Contributor Author

devos50 commented Jul 12, 2016

retest this please

@devos50
Copy link
Contributor Author

devos50 commented Jul 12, 2016

@whirm can you review this already? (see my last two commits)

@whirm
Copy link

whirm commented Jul 12, 2016

Looks fine, let's see if the tests pass

@whirm
Copy link

whirm commented Jul 12, 2016

Also, please send the fixes to next

Now, only the starting of the DHT is executed on the thread pool. The check itself is executed on the reactor thread.
@devos50
Copy link
Contributor Author

devos50 commented Jul 12, 2016

Still the same error on win64...

@brussee
Copy link
Member

brussee commented Jul 13, 2016

retest this please
edit: now the same error on win32

@brussee
Copy link
Member

brussee commented Jul 13, 2016

This PR is superseded by #2464

@whirm
Copy link

whirm commented Jul 14, 2016

Shouldn't it be closed then?

@brussee
Copy link
Member

brussee commented Jul 14, 2016

@devos50 You can close this one since your awesome commits are merged with #2464. Nice teamwork!

@devos50 devos50 closed this Jul 14, 2016
@devos50 devos50 deleted the start_download_infohash branch July 14, 2016 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants