{"action":"created","comment":{"url":"https://api.github.com/repos/airbnb/airflow/pulls/comments/44165883","id":44165883,"diff_hunk":"@@ -0,0 +1,81 @@\n+from airflow.hooks.base_hook import BaseHook\n+from airflow.configuration import conf\n+import logging\n+\n+from hdfs import InsecureClient, HdfsError\n+from airflow.utils import AirflowException\n+\n+\n+class WebHDFSHookException(AirflowException):\n+    pass\n+\n+\n+class WebHDFSHook(BaseHook):\n+    \"\"\"\n+    Interact with HDFS. This class is a wrapper around the hdfscli library.\n+    \"\"\"\n+    def __init__(self, webhdfs_conn_id='webhdfs_default'):\n+        self.webhdfs_conn_id = webhdfs_conn_id\n+\n+    def get_conn(self):\n+        \"\"\"\n+        Returns a hdfscli InsecureClient object.\n+        \"\"\"\n+        nn_connections = self.get_connections(self.webhdfs_conn_id)\n+        for nn in nn_connections:\n+            try:","path":"airflow/hooks/webhdfs_hook.py","position":26,"original_position":26,"commit_id":"3cba12ec036012c0940d3c19aa923f7cd3689ccc","original_commit_id":"3cba12ec036012c0940d3c19aa923f7cd3689ccc","user":{"login":"artwr","id":1518713,"avatar_url":"https://avatars.githubusercontent.com/u/1518713?v=3","gravatar_id":"","url":"https://api.github.com/users/artwr","html_url":"https://github.com/artwr","followers_url":"https://api.github.com/users/artwr/followers","following_url":"https://api.github.com/users/artwr/following{/other_user}","gists_url":"https://api.github.com/users/artwr/gists{/gist_id}","starred_url":"https://api.github.com/users/artwr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artwr/subscriptions","organizations_url":"https://api.github.com/users/artwr/orgs","repos_url":"https://api.github.com/users/artwr/repos","events_url":"https://api.github.com/users/artwr/events{/privacy}","received_events_url":"https://api.github.com/users/artwr/received_events","type":"User","site_admin":false},"body":"Not necessarily. It is a poor man's High Availability client so that we can enter a list of the namenodes (primary and secondary) in the connections. It only raises if all the namenodes with that connection ID fail. Are you suggesting we cache it and then rescue the specific error and retry with another namenode in the list if needed?","created_at":"2015-11-06T17:50:01Z","updated_at":"2015-11-06T17:50:01Z","html_url":"https://github.com/airbnb/airflow/pull/604#discussion_r44165883","pull_request_url":"https://api.github.com/repos/airbnb/airflow/pulls/604","_links":{"self":{"href":"https://api.github.com/repos/airbnb/airflow/pulls/comments/44165883"},"html":{"href":"https://github.com/airbnb/airflow/pull/604#discussion_r44165883"},"pull_request":{"href":"https://api.github.com/repos/airbnb/airflow/pulls/604"}}},"pull_request":{"url":"https://api.github.com/repos/airbnb/airflow/pulls/604","id":49903946,"html_url":"https://github.com/airbnb/airflow/pull/604","diff_url":"https://github.com/airbnb/airflow/pull/604.diff","patch_url":"https://github.com/airbnb/airflow/pull/604.patch","issue_url":"https://api.github.com/repos/airbnb/airflow/issues/604","number":604,"state":"open","locked":false,"title":"Hdfscli hook","user":{"login":"artwr","id":1518713,"avatar_url":"https://avatars.githubusercontent.com/u/1518713?v=3","gravatar_id":"","url":"https://api.github.com/users/artwr","html_url":"https://github.com/artwr","followers_url":"https://api.github.com/users/artwr/followers","following_url":"https://api.github.com/users/artwr/following{/other_user}","gists_url":"https://api.github.com/users/artwr/gists{/gist_id}","starred_url":"https://api.github.com/users/artwr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artwr/subscriptions","organizations_url":"https://api.github.com/users/artwr/orgs","repos_url":"https://api.github.com/users/artwr/repos","events_url":"https://api.github.com/users/artwr/events{/privacy}","received_events_url":"https://api.github.com/users/artwr/received_events","type":"User","site_admin":false},"body":"@mistercrunch \r\nThis is a new hook using the `hdfs` [(See docs here)](http://hdfscli.readthedocs.org/en/latest/) to provide a way to speak with HDFS. The good news is that this package has far fewer dependencies than snakebite and is Python3 compatible.\r\n\r\nI wrote a load_file method for it, and a sensor that could be a drop in replacement for our current hdfs sensor.\r\n\r\nApparently advanced usage allows for serializing of [pandas data frames to HDFS through avro](http://hdfscli.readthedocs.org/en/latest/api.html#module-hdfs.ext.dataframe) (I included the dependecy on dataframe, but it could be removed for now).\r\n\r\nTest included for the sensor, I tested the load_file method locally but did not write a transfer test.\r\n\r\nLet me know what you think.\r\n\r\n ","created_at":"2015-11-06T01:03:32Z","updated_at":"2015-11-06T17:50:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b823bb823490b1bc708e02918facb9d547489c4b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/airbnb/airflow/pulls/604/commits","review_comments_url":"https://api.github.com/repos/airbnb/airflow/pulls/604/comments","review_comment_url":"https://api.github.com/repos/airbnb/airflow/pulls/comments{/number}","comments_url":"https://api.github.com/repos/airbnb/airflow/issues/604/comments","statuses_url":"https://api.github.com/repos/airbnb/airflow/statuses/3cba12ec036012c0940d3c19aa923f7cd3689ccc","head":{"label":"airbnb:hdfscli_hook","ref":"hdfscli_hook","sha":"3cba12ec036012c0940d3c19aa923f7cd3689ccc","user":{"login":"airbnb","id":698437,"avatar_url":"https://avatars.githubusercontent.com/u/698437?v=3","gravatar_id":"","url":"https://api.github.com/users/airbnb","html_url":"https://github.com/airbnb","followers_url":"https://api.github.com/users/airbnb/followers","following_url":"https://api.github.com/users/airbnb/following{/other_user}","gists_url":"https://api.github.com/users/airbnb/gists{/gist_id}","starred_url":"https://api.github.com/users/airbnb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/airbnb/subscriptions","organizations_url":"https://api.github.com/users/airbnb/orgs","repos_url":"https://api.github.com/users/airbnb/repos","events_url":"https://api.github.com/users/airbnb/events{/privacy}","received_events_url":"https://api.github.com/users/airbnb/received_events","type":"Organization","site_admin":false},"repo":{"id":33884891,"name":"airflow","full_name":"airbnb/airflow","owner":{"login":"airbnb","id":698437,"avatar_url":"https://avatars.githubusercontent.com/u/698437?v=3","gravatar_id":"","url":"https://api.github.com/users/airbnb","html_url":"https://github.com/airbnb","followers_url":"https://api.github.com/users/airbnb/followers","following_url":"https://api.github.com/users/airbnb/following{/other_user}","gists_url":"https://api.github.com/users/airbnb/gists{/gist_id}","starred_url":"https://api.github.com/users/airbnb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/airbnb/subscriptions","organizations_url":"https://api.github.com/users/airbnb/orgs","repos_url":"https://api.github.com/users/airbnb/repos","events_url":"https://api.github.com/users/airbnb/events{/privacy}","received_events_url":"https://api.github.com/users/airbnb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/airbnb/airflow","description":"Airflow is a system to programmatically author, schedule and monitor data pipelines.","fork":false,"url":"https://api.github.com/repos/airbnb/airflow","forks_url":"https://api.github.com/repos/airbnb/airflow/forks","keys_url":"https://api.github.com/repos/airbnb/airflow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/airbnb/airflow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/airbnb/airflow/teams","hooks_url":"https://api.github.com/repos/airbnb/airflow/hooks","issue_events_url":"https://api.github.com/repos/airbnb/airflow/issues/events{/number}","events_url":"https://api.github.com/repos/airbnb/airflow/events","assignees_url":"https://api.github.com/repos/airbnb/airflow/assignees{/user}","branches_url":"https://api.github.com/repos/airbnb/airflow/branches{/branch}","tags_url":"https://api.github.com/repos/airbnb/airflow/tags","blobs_url":"https://api.github.com/repos/airbnb/airflow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/airbnb/airflow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/airbnb/airflow/git/refs{/sha}","trees_url":"https://api.github.com/repos/airbnb/airflow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/airbnb/airflow/statuses/{sha}","languages_url":"https://api.github.com/repos/airbnb/airflow/languages","stargazers_url":"https://api.github.com/repos/airbnb/airflow/stargazers","contributors_url":"https://api.github.com/repos/airbnb/airflow/contributors","subscribers_url":"https://api.github.com/repos/airbnb/airflow/subscribers","subscription_url":"https://api.github.com/repos/airbnb/airflow/subscription","commits_url":"https://api.github.com/repos/airbnb/airflow/commits{/sha}","git_commits_url":"https://api.github.com/repos/airbnb/airflow/git/commits{/sha}","comments_url":"https://api.github.com/repos/airbnb/airflow/comments{/number}","issue_comment_url":"https://api.github.com/repos/airbnb/airflow/issues/comments{/number}","contents_url":"https://api.github.com/repos/airbnb/airflow/contents/{+path}","compare_url":"https://api.github.com/repos/airbnb/airflow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/airbnb/airflow/merges","archive_url":"https://api.github.com/repos/airbnb/airflow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/airbnb/airflow/downloads","issues_url":"https://api.github.com/repos/airbnb/airflow/issues{/number}","pulls_url":"https://api.github.com/repos/airbnb/airflow/pulls{/number}","milestones_url":"https://api.github.com/repos/airbnb/airflow/milestones{/number}","notifications_url":"https://api.github.com/repos/airbnb/airflow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/airbnb/airflow/labels{/name}","releases_url":"https://api.github.com/repos/airbnb/airflow/releases{/id}","created_at":"2015-04-13T18:04:58Z","updated_at":"2015-11-06T15:29:54Z","pushed_at":"2015-11-06T13:03:58Z","git_url":"git://github.com/airbnb/airflow.git","ssh_url":"git@github.com:airbnb/airflow.git","clone_url":"https://github.com/airbnb/airflow.git","svn_url":"https://github.com/airbnb/airflow","homepage":"","size":10607,"stargazers_count":1326,"watchers_count":1326,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":237,"mirror_url":null,"open_issues_count":98,"forks":237,"open_issues":98,"watchers":1326,"default_branch":"master"}},"base":{"label":"airbnb:master","ref":"master","sha":"facea71827a1f786cfa64b67b908c93aae431d26","user":{"login":"airbnb","id":698437,"avatar_url":"https://avatars.githubusercontent.com/u/698437?v=3","gravatar_id":"","url":"https://api.github.com/users/airbnb","html_url":"https://github.com/airbnb","followers_url":"https://api.github.com/users/airbnb/followers","following_url":"https://api.github.com/users/airbnb/following{/other_user}","gists_url":"https://api.github.com/users/airbnb/gists{/gist_id}","starred_url":"https://api.github.com/users/airbnb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/airbnb/subscriptions","organizations_url":"https://api.github.com/users/airbnb/orgs","repos_url":"https://api.github.com/users/airbnb/repos","events_url":"https://api.github.com/users/airbnb/events{/privacy}","received_events_url":"https://api.github.com/users/airbnb/received_events","type":"Organization","site_admin":false},"repo":{"id":33884891,"name":"airflow","full_name":"airbnb/airflow","owner":{"login":"airbnb","id":698437,"avatar_url":"https://avatars.githubusercontent.com/u/698437?v=3","gravatar_id":"","url":"https://api.github.com/users/airbnb","html_url":"https://github.com/airbnb","followers_url":"https://api.github.com/users/airbnb/followers","following_url":"https://api.github.com/users/airbnb/following{/other_user}","gists_url":"https://api.github.com/users/airbnb/gists{/gist_id}","starred_url":"https://api.github.com/users/airbnb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/airbnb/subscriptions","organizations_url":"https://api.github.com/users/airbnb/orgs","repos_url":"https://api.github.com/users/airbnb/repos","events_url":"https://api.github.com/users/airbnb/events{/privacy}","received_events_url":"https://api.github.com/users/airbnb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/airbnb/airflow","description":"Airflow is a system to programmatically author, schedule and monitor data pipelines.","fork":false,"url":"https://api.github.com/repos/airbnb/airflow","forks_url":"https://api.github.com/repos/airbnb/airflow/forks","keys_url":"https://api.github.com/repos/airbnb/airflow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/airbnb/airflow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/airbnb/airflow/teams","hooks_url":"https://api.github.com/repos/airbnb/airflow/hooks","issue_events_url":"https://api.github.com/repos/airbnb/airflow/issues/events{/number}","events_url":"https://api.github.com/repos/airbnb/airflow/events","assignees_url":"https://api.github.com/repos/airbnb/airflow/assignees{/user}","branches_url":"https://api.github.com/repos/airbnb/airflow/branches{/branch}","tags_url":"https://api.github.com/repos/airbnb/airflow/tags","blobs_url":"https://api.github.com/repos/airbnb/airflow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/airbnb/airflow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/airbnb/airflow/git/refs{/sha}","trees_url":"https://api.github.com/repos/airbnb/airflow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/airbnb/airflow/statuses/{sha}","languages_url":"https://api.github.com/repos/airbnb/airflow/languages","stargazers_url":"https://api.github.com/repos/airbnb/airflow/stargazers","contributors_url":"https://api.github.com/repos/airbnb/airflow/contributors","subscribers_url":"https://api.github.com/repos/airbnb/airflow/subscribers","subscription_url":"https://api.github.com/repos/airbnb/airflow/subscription","commits_url":"https://api.github.com/repos/airbnb/airflow/commits{/sha}","git_commits_url":"https://api.github.com/repos/airbnb/airflow/git/commits{/sha}","comments_url":"https://api.github.com/repos/airbnb/airflow/comments{/number}","issue_comment_url":"https://api.github.com/repos/airbnb/airflow/issues/comments{/number}","contents_url":"https://api.github.com/repos/airbnb/airflow/contents/{+path}","compare_url":"https://api.github.com/repos/airbnb/airflow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/airbnb/airflow/merges","archive_url":"https://api.github.com/repos/airbnb/airflow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/airbnb/airflow/downloads","issues_url":"https://api.github.com/repos/airbnb/airflow/issues{/number}","pulls_url":"https://api.github.com/repos/airbnb/airflow/pulls{/number}","milestones_url":"https://api.github.com/repos/airbnb/airflow/milestones{/number}","notifications_url":"https://api.github.com/repos/airbnb/airflow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/airbnb/airflow/labels{/name}","releases_url":"https://api.github.com/repos/airbnb/airflow/releases{/id}","created_at":"2015-04-13T18:04:58Z","updated_at":"2015-11-06T15:29:54Z","pushed_at":"2015-11-06T13:03:58Z","git_url":"git://github.com/airbnb/airflow.git","ssh_url":"git@github.com:airbnb/airflow.git","clone_url":"https://github.com/airbnb/airflow.git","svn_url":"https://github.com/airbnb/airflow","homepage":"","size":10607,"stargazers_count":1326,"watchers_count":1326,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":237,"mirror_url":null,"open_issues_count":98,"forks":237,"open_issues":98,"watchers":1326,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/airbnb/airflow/pulls/604"},"html":{"href":"https://github.com/airbnb/airflow/pull/604"},"issue":{"href":"https://api.github.com/repos/airbnb/airflow/issues/604"},"comments":{"href":"https://api.github.com/repos/airbnb/airflow/issues/604/comments"},"review_comments":{"href":"https://api.github.com/repos/airbnb/airflow/pulls/604/comments"},"review_comment":{"href":"https://api.github.com/repos/airbnb/airflow/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/airbnb/airflow/pulls/604/commits"},"statuses":{"href":"https://api.github.com/repos/airbnb/airflow/statuses/3cba12ec036012c0940d3c19aa923f7cd3689ccc"}}}}