{"action":"created","comment":{"url":"https://api.github.com/repos/TheTorProject/ooni-probe/pulls/comments/78932526","id":78932526,"diff_hunk":"@@ -0,0 +1,409 @@\n+import os\n+import errno\n+\n+from hashlib import md5\n+from datetime import datetime\n+\n+from twisted.application import service\n+from twisted.internet import defer\n+from twisted.internet.task import LoopingCall\n+from twisted.python.filepath import FilePath\n+\n+from ooni.scripts import oonireport\n+from ooni import resources\n+from ooni.utils import log, SHORT_DATE\n+from ooni.utils.files import human_size_to_bytes, directory_usage\n+from ooni.deck.store import input_store, deck_store, DEFAULT_DECKS\n+from ooni.settings import config\n+from ooni.contrib import croniter\n+from ooni.contrib.dateutil.tz import tz\n+\n+from ooni.geoip import probe_ip\n+from ooni.measurements import list_measurements\n+\n+class FileSystemlockAndMutex(object):\n+    \"\"\"\n+    This is a lock that is both a mutex lock and also on filesystem.\n+    When you acquire it, it will first block on the mutex lock and then\n+    once that is released it will attempt to acquire the lock on the\n+    filesystem.\n+\n+    It's a way to support concurrent usage of the DeferredFilesystemLock\n+    without races.\n+    \"\"\"\n+    def __init__(self, file_path):\n+        self._fs_lock = defer.DeferredFilesystemLock(file_path)\n+        self._mutex = defer.DeferredLock()\n+\n+    @defer.inlineCallbacks\n+    def acquire(self):\n+        yield self._mutex.acquire()\n+        yield self._fs_lock.deferUntilLocked()\n+\n+    def release(self):\n+        self._fs_lock.unlock()\n+        self._mutex.release()\n+\n+    @property\n+    def locked(self):\n+        return self._mutex.locked or self._fs_lock.locked\n+\n+# We use this date to indicate that the scheduled task has never run.\n+# Easter egg, try to see what is special about this date :)?\n+CANARY_DATE = datetime(1957, 8, 4, tzinfo=tz.tzutc())\n+\n+\n+class DidNotRun(Exception):\n+    pass\n+\n+\n+class ScheduledTask(object):\n+    _time_format = \"%Y-%m-%dT%H:%M:%SZ\"\n+    schedule = None\n+    identifier = None\n+\n+    def __init__(self, schedule=None, identifier=None,\n+                 scheduler_directory=config.scheduler_directory):\n+        if schedule is not None:\n+            self.schedule = schedule\n+        if identifier is not None:\n+            self.identifier = identifier","path":"ooni/agent/scheduler.py","position":73,"original_position":70,"commit_id":"0e452b1c70607da8d389988bb72e85b6b229fe4b","original_commit_id":"2ab3219a6044b27c47dd310c1e6cecec20f006fd","user":{"login":"hellais","id":424620,"avatar_url":"https://avatars.githubusercontent.com/u/424620?v=3","gravatar_id":"","url":"https://api.github.com/users/hellais","html_url":"https://github.com/hellais","followers_url":"https://api.github.com/users/hellais/followers","following_url":"https://api.github.com/users/hellais/following{/other_user}","gists_url":"https://api.github.com/users/hellais/gists{/gist_id}","starred_url":"https://api.github.com/users/hellais/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hellais/subscriptions","organizations_url":"https://api.github.com/users/hellais/orgs","repos_url":"https://api.github.com/users/hellais/repos","events_url":"https://api.github.com/users/hellais/events{/privacy}","received_events_url":"https://api.github.com/users/hellais/received_events","type":"User","site_admin":false},"body":"I am not sure I understand what you say here. The reason for supporting also passing in arguments is that, the subclass should be able to specify what is the default schedule, but a user of the task may decide to override it with something else at runtime. Same thing goes for the identifier, that in some cases needs to be specialised (for example with the RunDeck task).","created_at":"2016-09-15T10:25:26Z","updated_at":"2016-09-15T10:25:26Z","html_url":"https://github.com/TheTorProject/ooni-probe/pull/582#discussion_r78932526","pull_request_url":"https://api.github.com/repos/TheTorProject/ooni-probe/pulls/582","_links":{"self":{"href":"https://api.github.com/repos/TheTorProject/ooni-probe/pulls/comments/78932526"},"html":{"href":"https://github.com/TheTorProject/ooni-probe/pull/582#discussion_r78932526"},"pull_request":{"href":"https://api.github.com/repos/TheTorProject/ooni-probe/pulls/582"}}},"pull_request":{"url":"https://api.github.com/repos/TheTorProject/ooni-probe/pulls/582","id":79924226,"html_url":"https://github.com/TheTorProject/ooni-probe/pull/582","diff_url":"https://github.com/TheTorProject/ooni-probe/pull/582.diff","patch_url":"https://github.com/TheTorProject/ooni-probe/pull/582.patch","issue_url":"https://api.github.com/repos/TheTorProject/ooni-probe/issues/582","number":582,"state":"open","locked":false,"title":"V2.0.0 alpha","user":{"login":"hellais","id":424620,"avatar_url":"https://avatars.githubusercontent.com/u/424620?v=3","gravatar_id":"","url":"https://api.github.com/users/hellais","html_url":"https://github.com/hellais","followers_url":"https://api.github.com/users/hellais/followers","following_url":"https://api.github.com/users/hellais/following{/other_user}","gists_url":"https://api.github.com/users/hellais/gists{/gist_id}","starred_url":"https://api.github.com/users/hellais/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hellais/subscriptions","organizations_url":"https://api.github.com/users/hellais/orgs","repos_url":"https://api.github.com/users/hellais/repos","events_url":"https://api.github.com/users/hellais/events{/privacy}","received_events_url":"https://api.github.com/users/hellais/received_events","type":"User","site_admin":false},"body":"This is the work in progress branch to keep track of the status of ooniprobe alpha.\r\n\r\nWe are probably not going to be integrating this into master sooner than end of August, early September. So the purpose of this is give people a tip that they can use to test ooniprobe 2.0.0 and keep track of when it's ready to be finally integrated into master.","created_at":"2016-08-03T15:12:55Z","updated_at":"2016-09-15T10:25:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"14b2e5b43019fdff701c2f3c031e55f8f242ec65","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/TheTorProject/ooni-probe/pulls/582/commits","review_comments_url":"https://api.github.com/repos/TheTorProject/ooni-probe/pulls/582/comments","review_comment_url":"https://api.github.com/repos/TheTorProject/ooni-probe/pulls/comments{/number}","comments_url":"https://api.github.com/repos/TheTorProject/ooni-probe/issues/582/comments","statuses_url":"https://api.github.com/repos/TheTorProject/ooni-probe/statuses/0e452b1c70607da8d389988bb72e85b6b229fe4b","head":{"label":"TheTorProject:v2.0.0-alpha","ref":"v2.0.0-alpha","sha":"0e452b1c70607da8d389988bb72e85b6b229fe4b","user":{"login":"TheTorProject","id":3301912,"avatar_url":"https://avatars.githubusercontent.com/u/3301912?v=3","gravatar_id":"","url":"https://api.github.com/users/TheTorProject","html_url":"https://github.com/TheTorProject","followers_url":"https://api.github.com/users/TheTorProject/followers","following_url":"https://api.github.com/users/TheTorProject/following{/other_user}","gists_url":"https://api.github.com/users/TheTorProject/gists{/gist_id}","starred_url":"https://api.github.com/users/TheTorProject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheTorProject/subscriptions","organizations_url":"https://api.github.com/users/TheTorProject/orgs","repos_url":"https://api.github.com/users/TheTorProject/repos","events_url":"https://api.github.com/users/TheTorProject/events{/privacy}","received_events_url":"https://api.github.com/users/TheTorProject/received_events","type":"Organization","site_admin":false},"repo":{"id":3944100,"name":"ooni-probe","full_name":"TheTorProject/ooni-probe","owner":{"login":"TheTorProject","id":3301912,"avatar_url":"https://avatars.githubusercontent.com/u/3301912?v=3","gravatar_id":"","url":"https://api.github.com/users/TheTorProject","html_url":"https://github.com/TheTorProject","followers_url":"https://api.github.com/users/TheTorProject/followers","following_url":"https://api.github.com/users/TheTorProject/following{/other_user}","gists_url":"https://api.github.com/users/TheTorProject/gists{/gist_id}","starred_url":"https://api.github.com/users/TheTorProject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheTorProject/subscriptions","organizations_url":"https://api.github.com/users/TheTorProject/orgs","repos_url":"https://api.github.com/users/TheTorProject/repos","events_url":"https://api.github.com/users/TheTorProject/events{/privacy}","received_events_url":"https://api.github.com/users/TheTorProject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/TheTorProject/ooni-probe","description":"ooni-probe: network measurement writing framework aimed at detecting network interference.","fork":false,"url":"https://api.github.com/repos/TheTorProject/ooni-probe","forks_url":"https://api.github.com/repos/TheTorProject/ooni-probe/forks","keys_url":"https://api.github.com/repos/TheTorProject/ooni-probe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TheTorProject/ooni-probe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TheTorProject/ooni-probe/teams","hooks_url":"https://api.github.com/repos/TheTorProject/ooni-probe/hooks","issue_events_url":"https://api.github.com/repos/TheTorProject/ooni-probe/issues/events{/number}","events_url":"https://api.github.com/repos/TheTorProject/ooni-probe/events","assignees_url":"https://api.github.com/repos/TheTorProject/ooni-probe/assignees{/user}","branches_url":"https://api.github.com/repos/TheTorProject/ooni-probe/branches{/branch}","tags_url":"https://api.github.com/repos/TheTorProject/ooni-probe/tags","blobs_url":"https://api.github.com/repos/TheTorProject/ooni-probe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TheTorProject/ooni-probe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TheTorProject/ooni-probe/git/refs{/sha}","trees_url":"https://api.github.com/repos/TheTorProject/ooni-probe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TheTorProject/ooni-probe/statuses/{sha}","languages_url":"https://api.github.com/repos/TheTorProject/ooni-probe/languages","stargazers_url":"https://api.github.com/repos/TheTorProject/ooni-probe/stargazers","contributors_url":"https://api.github.com/repos/TheTorProject/ooni-probe/contributors","subscribers_url":"https://api.github.com/repos/TheTorProject/ooni-probe/subscribers","subscription_url":"https://api.github.com/repos/TheTorProject/ooni-probe/subscription","commits_url":"https://api.github.com/repos/TheTorProject/ooni-probe/commits{/sha}","git_commits_url":"https://api.github.com/repos/TheTorProject/ooni-probe/git/commits{/sha}","comments_url":"https://api.github.com/repos/TheTorProject/ooni-probe/comments{/number}","issue_comment_url":"https://api.github.com/repos/TheTorProject/ooni-probe/issues/comments{/number}","contents_url":"https://api.github.com/repos/TheTorProject/ooni-probe/contents/{+path}","compare_url":"https://api.github.com/repos/TheTorProject/ooni-probe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TheTorProject/ooni-probe/merges","archive_url":"https://api.github.com/repos/TheTorProject/ooni-probe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TheTorProject/ooni-probe/downloads","issues_url":"https://api.github.com/repos/TheTorProject/ooni-probe/issues{/number}","pulls_url":"https://api.github.com/repos/TheTorProject/ooni-probe/pulls{/number}","milestones_url":"https://api.github.com/repos/TheTorProject/ooni-probe/milestones{/number}","notifications_url":"https://api.github.com/repos/TheTorProject/ooni-probe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TheTorProject/ooni-probe/labels{/name}","releases_url":"https://api.github.com/repos/TheTorProject/ooni-probe/releases{/id}","deployments_url":"https://api.github.com/repos/TheTorProject/ooni-probe/deployments","created_at":"2012-04-05T20:59:23Z","updated_at":"2016-09-15T06:59:15Z","pushed_at":"2016-09-14T15:11:36Z","git_url":"git://github.com/TheTorProject/ooni-probe.git","ssh_url":"git@github.com:TheTorProject/ooni-probe.git","clone_url":"https://github.com/TheTorProject/ooni-probe.git","svn_url":"https://github.com/TheTorProject/ooni-probe","homepage":"https://ooni.torproject.org","size":6756,"stargazers_count":267,"watchers_count":267,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":94,"mirror_url":null,"open_issues_count":59,"forks":94,"open_issues":59,"watchers":267,"default_branch":"master"}},"base":{"label":"TheTorProject:master","ref":"master","sha":"da00195094cdf22678d42608cdbc3bb22b9d757e","user":{"login":"TheTorProject","id":3301912,"avatar_url":"https://avatars.githubusercontent.com/u/3301912?v=3","gravatar_id":"","url":"https://api.github.com/users/TheTorProject","html_url":"https://github.com/TheTorProject","followers_url":"https://api.github.com/users/TheTorProject/followers","following_url":"https://api.github.com/users/TheTorProject/following{/other_user}","gists_url":"https://api.github.com/users/TheTorProject/gists{/gist_id}","starred_url":"https://api.github.com/users/TheTorProject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheTorProject/subscriptions","organizations_url":"https://api.github.com/users/TheTorProject/orgs","repos_url":"https://api.github.com/users/TheTorProject/repos","events_url":"https://api.github.com/users/TheTorProject/events{/privacy}","received_events_url":"https://api.github.com/users/TheTorProject/received_events","type":"Organization","site_admin":false},"repo":{"id":3944100,"name":"ooni-probe","full_name":"TheTorProject/ooni-probe","owner":{"login":"TheTorProject","id":3301912,"avatar_url":"https://avatars.githubusercontent.com/u/3301912?v=3","gravatar_id":"","url":"https://api.github.com/users/TheTorProject","html_url":"https://github.com/TheTorProject","followers_url":"https://api.github.com/users/TheTorProject/followers","following_url":"https://api.github.com/users/TheTorProject/following{/other_user}","gists_url":"https://api.github.com/users/TheTorProject/gists{/gist_id}","starred_url":"https://api.github.com/users/TheTorProject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheTorProject/subscriptions","organizations_url":"https://api.github.com/users/TheTorProject/orgs","repos_url":"https://api.github.com/users/TheTorProject/repos","events_url":"https://api.github.com/users/TheTorProject/events{/privacy}","received_events_url":"https://api.github.com/users/TheTorProject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/TheTorProject/ooni-probe","description":"ooni-probe: network measurement writing framework aimed at detecting network interference.","fork":false,"url":"https://api.github.com/repos/TheTorProject/ooni-probe","forks_url":"https://api.github.com/repos/TheTorProject/ooni-probe/forks","keys_url":"https://api.github.com/repos/TheTorProject/ooni-probe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TheTorProject/ooni-probe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TheTorProject/ooni-probe/teams","hooks_url":"https://api.github.com/repos/TheTorProject/ooni-probe/hooks","issue_events_url":"https://api.github.com/repos/TheTorProject/ooni-probe/issues/events{/number}","events_url":"https://api.github.com/repos/TheTorProject/ooni-probe/events","assignees_url":"https://api.github.com/repos/TheTorProject/ooni-probe/assignees{/user}","branches_url":"https://api.github.com/repos/TheTorProject/ooni-probe/branches{/branch}","tags_url":"https://api.github.com/repos/TheTorProject/ooni-probe/tags","blobs_url":"https://api.github.com/repos/TheTorProject/ooni-probe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TheTorProject/ooni-probe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TheTorProject/ooni-probe/git/refs{/sha}","trees_url":"https://api.github.com/repos/TheTorProject/ooni-probe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TheTorProject/ooni-probe/statuses/{sha}","languages_url":"https://api.github.com/repos/TheTorProject/ooni-probe/languages","stargazers_url":"https://api.github.com/repos/TheTorProject/ooni-probe/stargazers","contributors_url":"https://api.github.com/repos/TheTorProject/ooni-probe/contributors","subscribers_url":"https://api.github.com/repos/TheTorProject/ooni-probe/subscribers","subscription_url":"https://api.github.com/repos/TheTorProject/ooni-probe/subscription","commits_url":"https://api.github.com/repos/TheTorProject/ooni-probe/commits{/sha}","git_commits_url":"https://api.github.com/repos/TheTorProject/ooni-probe/git/commits{/sha}","comments_url":"https://api.github.com/repos/TheTorProject/ooni-probe/comments{/number}","issue_comment_url":"https://api.github.com/repos/TheTorProject/ooni-probe/issues/comments{/number}","contents_url":"https://api.github.com/repos/TheTorProject/ooni-probe/contents/{+path}","compare_url":"https://api.github.com/repos/TheTorProject/ooni-probe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TheTorProject/ooni-probe/merges","archive_url":"https://api.github.com/repos/TheTorProject/ooni-probe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TheTorProject/ooni-probe/downloads","issues_url":"https://api.github.com/repos/TheTorProject/ooni-probe/issues{/number}","pulls_url":"https://api.github.com/repos/TheTorProject/ooni-probe/pulls{/number}","milestones_url":"https://api.github.com/repos/TheTorProject/ooni-probe/milestones{/number}","notifications_url":"https://api.github.com/repos/TheTorProject/ooni-probe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TheTorProject/ooni-probe/labels{/name}","releases_url":"https://api.github.com/repos/TheTorProject/ooni-probe/releases{/id}","deployments_url":"https://api.github.com/repos/TheTorProject/ooni-probe/deployments","created_at":"2012-04-05T20:59:23Z","updated_at":"2016-09-15T06:59:15Z","pushed_at":"2016-09-14T15:11:36Z","git_url":"git://github.com/TheTorProject/ooni-probe.git","ssh_url":"git@github.com:TheTorProject/ooni-probe.git","clone_url":"https://github.com/TheTorProject/ooni-probe.git","svn_url":"https://github.com/TheTorProject/ooni-probe","homepage":"https://ooni.torproject.org","size":6756,"stargazers_count":267,"watchers_count":267,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":94,"mirror_url":null,"open_issues_count":59,"forks":94,"open_issues":59,"watchers":267,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/TheTorProject/ooni-probe/pulls/582"},"html":{"href":"https://github.com/TheTorProject/ooni-probe/pull/582"},"issue":{"href":"https://api.github.com/repos/TheTorProject/ooni-probe/issues/582"},"comments":{"href":"https://api.github.com/repos/TheTorProject/ooni-probe/issues/582/comments"},"review_comments":{"href":"https://api.github.com/repos/TheTorProject/ooni-probe/pulls/582/comments"},"review_comment":{"href":"https://api.github.com/repos/TheTorProject/ooni-probe/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/TheTorProject/ooni-probe/pulls/582/commits"},"statuses":{"href":"https://api.github.com/repos/TheTorProject/ooni-probe/statuses/0e452b1c70607da8d389988bb72e85b6b229fe4b"}}}}
{"actor":{"display_login":"hellais"}}