{"action":"created","comment":{"url":"https://api.github.com/repos/yangaws/incubator-airflow/pulls/comments/230228910","pull_request_review_id":170540610,"id":230228910,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMDIyODkxMA==","diff_hunk":"@@ -377,3 +420,124 @@ def load_bytes(self,\n \n         client = self.get_conn()\n         client.upload_fileobj(filelike_buffer, bucket_name, key, ExtraArgs=extra_args)\n+\n+    def load_file_obj(self,\n+                      file_obj,\n+                      key,\n+                      bucket_name=None,\n+                      replace=False,\n+                      encrypt=False):\n+        \"\"\"\n+        Loads file object to S3\n+\n+        :param file_obj: file-like object to set as content for the key.\n+        :type file_obj: file-like object\n+        :param key: S3 key that will point to the file\n+        :type key: str\n+        :param bucket_name: Name of the bucket in which to store the file\n+        :type bucket_name: str\n+        :param replace: A flag to decide whether or not to overwrite the key\n+            if it already exists\n+        :type replace: bool\n+        :param encrypt: If True, the file will be encrypted on the server-side\n+            by S3 and will be stored in an encrypted form while at rest in S3.\n+        :type encrypt: bool\n+        \"\"\"\n+        if not bucket_name:\n+            (bucket_name, key) = self.parse_s3_url(key)\n+\n+        if not replace and self.check_for_key(key, bucket_name):\n+            raise ValueError(\"The key {key} already exists.\".format(key=key))\n+\n+        extra_args = {}\n+        if encrypt:\n+            extra_args['ServerSideEncryption'] = \"AES256\"\n+\n+        client = self.get_conn()\n+        client.upload_fileobj(file_obj, bucket_name, key, ExtraArgs=extra_args)\n+\n+    def copy_object(self,\n+                    source_bucket_key,\n+                    dest_bucket_key,\n+                    source_bucket_name=None,\n+                    dest_bucket_name=None,\n+                    source_version_id=None):\n+        \"\"\"\n+        Creates a copy of an object that is already stored in S3.\n+\n+        Note: the S3 connection used here needs to have access to both\n+        source and destination bucket/key.\n+\n+        :param source_bucket_key: The key of the source object.\n+\n+            It can be either full s3:// style url or relative path from root level.\n+\n+            When it's specified as a full s3:// url, please omit source_bucket_name.\n+        :type source_bucket_key: str\n+        :param dest_bucket_key: The key of the object to copy to.\n+\n+            The convention to specify `dest_bucket_key` is the same\n+            as `source_bucket_key`.\n+        :type dest_bucket_key: str\n+        :param source_bucket_name: Name of the S3 bucket where the source object is in.\n+\n+            It should be omitted when `source_bucket_key` is provided as a full s3:// url.\n+        :type source_bucket_name: str\n+        :param dest_bucket_name: Name of the S3 bucket to where the object is copied.\n+\n+            It should be omitted when `dest_bucket_key` is provided as a full s3:// url.\n+        :type dest_bucket_name: str\n+        :param source_version_id: Version ID of the source object (OPTIONAL)\n+        :type source_version_id: str\n+        \"\"\"\n+\n+        if dest_bucket_name is None:\n+            dest_bucket_name, dest_bucket_key = self.parse_s3_url(dest_bucket_key)\n+        else:\n+            parsed_url = urlparse(dest_bucket_key)\n+            if parsed_url.scheme != '' or parsed_url.netloc != '':\n+                raise AirflowException('If dest_bucket_name is provided, ' +\n+                                       'dest_bucket_key should be relative path ' +\n+                                       'from root level, rather than a full s3:// url')\n+\n+        if source_bucket_name is None:\n+            source_bucket_name, source_bucket_key = self.parse_s3_url(source_bucket_key)\n+        else:\n+            parsed_url = urlparse(source_bucket_key)\n+            if parsed_url.scheme != '' or parsed_url.netloc != '':\n+                raise AirflowException('If source_bucket_name is provided, ' +\n+                                       'source_bucket_key should be relative path ' +\n+                                       'from root level, rather than a full s3:// url')\n+\n+        CopySource = {'Bucket': source_bucket_name,\n+                      'Key': source_bucket_key,\n+                      'VersionId': source_version_id}\n+        response = self.get_conn().copy_object(Bucket=dest_bucket_name,\n+                                               Key=dest_bucket_key,\n+                                               CopySource=CopySource)\n+        return response\n+\n+    def delete_objects(self,\n+                       bucket,\n+                       keys):\n+        \"\"\"\n+        :param bucket: Name of the bucket in which you are going to delete object(s)\n+        :type bucket: str\n+        :param keys: The key(s) to delete from S3 bucket.\n+\n+            When ``keys`` is a string, it's supposed to be the key name of","path":"airflow/hooks/S3_hook.py","position":237,"original_position":237,"commit_id":"1c52f0df37e6be4282e682efb37a6a52799f115d","original_commit_id":"1c52f0df37e6be4282e682efb37a6a52799f115d","user":{"login":"eslesar-aws","id":34587362,"node_id":"MDQ6VXNlcjM0NTg3MzYy","avatar_url":"https://avatars3.githubusercontent.com/u/34587362?v=4","gravatar_id":"","url":"https://api.github.com/users/eslesar-aws","html_url":"https://github.com/eslesar-aws","followers_url":"https://api.github.com/users/eslesar-aws/followers","following_url":"https://api.github.com/users/eslesar-aws/following{/other_user}","gists_url":"https://api.github.com/users/eslesar-aws/gists{/gist_id}","starred_url":"https://api.github.com/users/eslesar-aws/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eslesar-aws/subscriptions","organizations_url":"https://api.github.com/users/eslesar-aws/orgs","repos_url":"https://api.github.com/users/eslesar-aws/repos","events_url":"https://api.github.com/users/eslesar-aws/events{/privacy}","received_events_url":"https://api.github.com/users/eslesar-aws/received_events","type":"User","site_admin":false},"body":"If ``keys`` is a string, it must be the key name of the single object to delete.\r\n\r\nIf ``keys`` is a list, it must be the list of the keys to delete.","created_at":"2018-11-01T23:10:35Z","updated_at":"2018-11-01T23:16:06Z","html_url":"https://github.com/yangaws/incubator-airflow/pull/3#discussion_r230228910","pull_request_url":"https://api.github.com/repos/yangaws/incubator-airflow/pulls/3","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/yangaws/incubator-airflow/pulls/comments/230228910"},"html":{"href":"https://github.com/yangaws/incubator-airflow/pull/3#discussion_r230228910"},"pull_request":{"href":"https://api.github.com/repos/yangaws/incubator-airflow/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/yangaws/incubator-airflow/pulls/3","id":224767985,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI0NzY3OTg1","html_url":"https://github.com/yangaws/incubator-airflow/pull/3","diff_url":"https://github.com/yangaws/incubator-airflow/pull/3.diff","patch_url":"https://github.com/yangaws/incubator-airflow/pull/3.patch","issue_url":"https://api.github.com/repos/yangaws/incubator-airflow/issues/3","number":3,"state":"open","locked":false,"title":"Sagemaker in airflow","user":{"login":"yangaws","id":31293788,"node_id":"MDQ6VXNlcjMxMjkzNzg4","avatar_url":"https://avatars3.githubusercontent.com/u/31293788?v=4","gravatar_id":"","url":"https://api.github.com/users/yangaws","html_url":"https://github.com/yangaws","followers_url":"https://api.github.com/users/yangaws/followers","following_url":"https://api.github.com/users/yangaws/following{/other_user}","gists_url":"https://api.github.com/users/yangaws/gists{/gist_id}","starred_url":"https://api.github.com/users/yangaws/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yangaws/subscriptions","organizations_url":"https://api.github.com/users/yangaws/orgs","repos_url":"https://api.github.com/users/yangaws/repos","events_url":"https://api.github.com/users/yangaws/events{/privacy}","received_events_url":"https://api.github.com/users/yangaws/received_events","type":"User","site_admin":false},"body":"Description:\r\n1. Update aws_base_hook to support customized botocore configs\r\n2. Update s3_hook with two more simple APIs, create_bucket and load_file_obj\r\n3. Add sagemaker_hook with major sagemaker APIs including APIs to create and describe (training job, tuning job, transform job, model, endpoint-config, endpoint)\r\n4. Add sagemaker operators including creating training job, tuning job, transform job, model, endpoint-config, endpoint. And a special one called deploy operator which combines model, endpoint-config and endpoint creation.\r\n5. Add sagemaker sensors for sensing training job, tuning job, transform job, model, endpoint which might be time-consuming.\r\n6. Add unit tests for all above. \r\n\r\nTests:\r\n1. Manually run all the unit tests\r\n2. Run example DAGs with Pytorch (training and deployment), Tensorflow (training and transform), Mxnet (Tuning)\r\n3. Since this branch is developed based on airflow 1.10 stable branch. I will run tests again before submitting final PR since that one would be based on airflow master.","created_at":"2018-10-22T18:21:26Z","updated_at":"2018-11-01T23:16:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e442c5a1ad5f0652eab795e0dbfc02bd72d9a94f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/yangaws/incubator-airflow/pulls/3/commits","review_comments_url":"https://api.github.com/repos/yangaws/incubator-airflow/pulls/3/comments","review_comment_url":"https://api.github.com/repos/yangaws/incubator-airflow/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yangaws/incubator-airflow/issues/3/comments","statuses_url":"https://api.github.com/repos/yangaws/incubator-airflow/statuses/1c52f0df37e6be4282e682efb37a6a52799f115d","head":{"label":"yangaws:sagemaker_in_airflow","ref":"sagemaker_in_airflow","sha":"1c52f0df37e6be4282e682efb37a6a52799f115d","user":{"login":"yangaws","id":31293788,"node_id":"MDQ6VXNlcjMxMjkzNzg4","avatar_url":"https://avatars3.githubusercontent.com/u/31293788?v=4","gravatar_id":"","url":"https://api.github.com/users/yangaws","html_url":"https://github.com/yangaws","followers_url":"https://api.github.com/users/yangaws/followers","following_url":"https://api.github.com/users/yangaws/following{/other_user}","gists_url":"https://api.github.com/users/yangaws/gists{/gist_id}","starred_url":"https://api.github.com/users/yangaws/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yangaws/subscriptions","organizations_url":"https://api.github.com/users/yangaws/orgs","repos_url":"https://api.github.com/users/yangaws/repos","events_url":"https://api.github.com/users/yangaws/events{/privacy}","received_events_url":"https://api.github.com/users/yangaws/received_events","type":"User","site_admin":false},"repo":{"id":136527929,"node_id":"MDEwOlJlcG9zaXRvcnkxMzY1Mjc5Mjk=","name":"incubator-airflow","full_name":"yangaws/incubator-airflow","private":false,"owner":{"login":"yangaws","id":31293788,"node_id":"MDQ6VXNlcjMxMjkzNzg4","avatar_url":"https://avatars3.githubusercontent.com/u/31293788?v=4","gravatar_id":"","url":"https://api.github.com/users/yangaws","html_url":"https://github.com/yangaws","followers_url":"https://api.github.com/users/yangaws/followers","following_url":"https://api.github.com/users/yangaws/following{/other_user}","gists_url":"https://api.github.com/users/yangaws/gists{/gist_id}","starred_url":"https://api.github.com/users/yangaws/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yangaws/subscriptions","organizations_url":"https://api.github.com/users/yangaws/orgs","repos_url":"https://api.github.com/users/yangaws/repos","events_url":"https://api.github.com/users/yangaws/events{/privacy}","received_events_url":"https://api.github.com/users/yangaws/received_events","type":"User","site_admin":false},"html_url":"https://github.com/yangaws/incubator-airflow","description":"Apache Airflow (Incubating)","fork":true,"url":"https://api.github.com/repos/yangaws/incubator-airflow","forks_url":"https://api.github.com/repos/yangaws/incubator-airflow/forks","keys_url":"https://api.github.com/repos/yangaws/incubator-airflow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yangaws/incubator-airflow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yangaws/incubator-airflow/teams","hooks_url":"https://api.github.com/repos/yangaws/incubator-airflow/hooks","issue_events_url":"https://api.github.com/repos/yangaws/incubator-airflow/issues/events{/number}","events_url":"https://api.github.com/repos/yangaws/incubator-airflow/events","assignees_url":"https://api.github.com/repos/yangaws/incubator-airflow/assignees{/user}","branches_url":"https://api.github.com/repos/yangaws/incubator-airflow/branches{/branch}","tags_url":"https://api.github.com/repos/yangaws/incubator-airflow/tags","blobs_url":"https://api.github.com/repos/yangaws/incubator-airflow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yangaws/incubator-airflow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yangaws/incubator-airflow/git/refs{/sha}","trees_url":"https://api.github.com/repos/yangaws/incubator-airflow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yangaws/incubator-airflow/statuses/{sha}","languages_url":"https://api.github.com/repos/yangaws/incubator-airflow/languages","stargazers_url":"https://api.github.com/repos/yangaws/incubator-airflow/stargazers","contributors_url":"https://api.github.com/repos/yangaws/incubator-airflow/contributors","subscribers_url":"https://api.github.com/repos/yangaws/incubator-airflow/subscribers","subscription_url":"https://api.github.com/repos/yangaws/incubator-airflow/subscription","commits_url":"https://api.github.com/repos/yangaws/incubator-airflow/commits{/sha}","git_commits_url":"https://api.github.com/repos/yangaws/incubator-airflow/git/commits{/sha}","comments_url":"https://api.github.com/repos/yangaws/incubator-airflow/comments{/number}","issue_comment_url":"https://api.github.com/repos/yangaws/incubator-airflow/issues/comments{/number}","contents_url":"https://api.github.com/repos/yangaws/incubator-airflow/contents/{+path}","compare_url":"https://api.github.com/repos/yangaws/incubator-airflow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yangaws/incubator-airflow/merges","archive_url":"https://api.github.com/repos/yangaws/incubator-airflow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yangaws/incubator-airflow/downloads","issues_url":"https://api.github.com/repos/yangaws/incubator-airflow/issues{/number}","pulls_url":"https://api.github.com/repos/yangaws/incubator-airflow/pulls{/number}","milestones_url":"https://api.github.com/repos/yangaws/incubator-airflow/milestones{/number}","notifications_url":"https://api.github.com/repos/yangaws/incubator-airflow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yangaws/incubator-airflow/labels{/name}","releases_url":"https://api.github.com/repos/yangaws/incubator-airflow/releases{/id}","deployments_url":"https://api.github.com/repos/yangaws/incubator-airflow/deployments","created_at":"2018-06-07T20:30:43Z","updated_at":"2018-10-24T19:17:34Z","pushed_at":"2018-11-01T00:34:31Z","git_url":"git://github.com/yangaws/incubator-airflow.git","ssh_url":"git@github.com:yangaws/incubator-airflow.git","clone_url":"https://github.com/yangaws/incubator-airflow.git","svn_url":"https://github.com/yangaws/incubator-airflow","homepage":"","size":26296,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"yangaws:v1-10-stable","ref":"v1-10-stable","sha":"26e0d449737e8671000f671d820a9537f23f345a","user":{"login":"yangaws","id":31293788,"node_id":"MDQ6VXNlcjMxMjkzNzg4","avatar_url":"https://avatars3.githubusercontent.com/u/31293788?v=4","gravatar_id":"","url":"https://api.github.com/users/yangaws","html_url":"https://github.com/yangaws","followers_url":"https://api.github.com/users/yangaws/followers","following_url":"https://api.github.com/users/yangaws/following{/other_user}","gists_url":"https://api.github.com/users/yangaws/gists{/gist_id}","starred_url":"https://api.github.com/users/yangaws/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yangaws/subscriptions","organizations_url":"https://api.github.com/users/yangaws/orgs","repos_url":"https://api.github.com/users/yangaws/repos","events_url":"https://api.github.com/users/yangaws/events{/privacy}","received_events_url":"https://api.github.com/users/yangaws/received_events","type":"User","site_admin":false},"repo":{"id":136527929,"node_id":"MDEwOlJlcG9zaXRvcnkxMzY1Mjc5Mjk=","name":"incubator-airflow","full_name":"yangaws/incubator-airflow","private":false,"owner":{"login":"yangaws","id":31293788,"node_id":"MDQ6VXNlcjMxMjkzNzg4","avatar_url":"https://avatars3.githubusercontent.com/u/31293788?v=4","gravatar_id":"","url":"https://api.github.com/users/yangaws","html_url":"https://github.com/yangaws","followers_url":"https://api.github.com/users/yangaws/followers","following_url":"https://api.github.com/users/yangaws/following{/other_user}","gists_url":"https://api.github.com/users/yangaws/gists{/gist_id}","starred_url":"https://api.github.com/users/yangaws/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yangaws/subscriptions","organizations_url":"https://api.github.com/users/yangaws/orgs","repos_url":"https://api.github.com/users/yangaws/repos","events_url":"https://api.github.com/users/yangaws/events{/privacy}","received_events_url":"https://api.github.com/users/yangaws/received_events","type":"User","site_admin":false},"html_url":"https://github.com/yangaws/incubator-airflow","description":"Apache Airflow (Incubating)","fork":true,"url":"https://api.github.com/repos/yangaws/incubator-airflow","forks_url":"https://api.github.com/repos/yangaws/incubator-airflow/forks","keys_url":"https://api.github.com/repos/yangaws/incubator-airflow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yangaws/incubator-airflow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yangaws/incubator-airflow/teams","hooks_url":"https://api.github.com/repos/yangaws/incubator-airflow/hooks","issue_events_url":"https://api.github.com/repos/yangaws/incubator-airflow/issues/events{/number}","events_url":"https://api.github.com/repos/yangaws/incubator-airflow/events","assignees_url":"https://api.github.com/repos/yangaws/incubator-airflow/assignees{/user}","branches_url":"https://api.github.com/repos/yangaws/incubator-airflow/branches{/branch}","tags_url":"https://api.github.com/repos/yangaws/incubator-airflow/tags","blobs_url":"https://api.github.com/repos/yangaws/incubator-airflow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yangaws/incubator-airflow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yangaws/incubator-airflow/git/refs{/sha}","trees_url":"https://api.github.com/repos/yangaws/incubator-airflow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yangaws/incubator-airflow/statuses/{sha}","languages_url":"https://api.github.com/repos/yangaws/incubator-airflow/languages","stargazers_url":"https://api.github.com/repos/yangaws/incubator-airflow/stargazers","contributors_url":"https://api.github.com/repos/yangaws/incubator-airflow/contributors","subscribers_url":"https://api.github.com/repos/yangaws/incubator-airflow/subscribers","subscription_url":"https://api.github.com/repos/yangaws/incubator-airflow/subscription","commits_url":"https://api.github.com/repos/yangaws/incubator-airflow/commits{/sha}","git_commits_url":"https://api.github.com/repos/yangaws/incubator-airflow/git/commits{/sha}","comments_url":"https://api.github.com/repos/yangaws/incubator-airflow/comments{/number}","issue_comment_url":"https://api.github.com/repos/yangaws/incubator-airflow/issues/comments{/number}","contents_url":"https://api.github.com/repos/yangaws/incubator-airflow/contents/{+path}","compare_url":"https://api.github.com/repos/yangaws/incubator-airflow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yangaws/incubator-airflow/merges","archive_url":"https://api.github.com/repos/yangaws/incubator-airflow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yangaws/incubator-airflow/downloads","issues_url":"https://api.github.com/repos/yangaws/incubator-airflow/issues{/number}","pulls_url":"https://api.github.com/repos/yangaws/incubator-airflow/pulls{/number}","milestones_url":"https://api.github.com/repos/yangaws/incubator-airflow/milestones{/number}","notifications_url":"https://api.github.com/repos/yangaws/incubator-airflow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yangaws/incubator-airflow/labels{/name}","releases_url":"https://api.github.com/repos/yangaws/incubator-airflow/releases{/id}","deployments_url":"https://api.github.com/repos/yangaws/incubator-airflow/deployments","created_at":"2018-06-07T20:30:43Z","updated_at":"2018-10-24T19:17:34Z","pushed_at":"2018-11-01T00:34:31Z","git_url":"git://github.com/yangaws/incubator-airflow.git","ssh_url":"git@github.com:yangaws/incubator-airflow.git","clone_url":"https://github.com/yangaws/incubator-airflow.git","svn_url":"https://github.com/yangaws/incubator-airflow","homepage":"","size":26296,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yangaws/incubator-airflow/pulls/3"},"html":{"href":"https://github.com/yangaws/incubator-airflow/pull/3"},"issue":{"href":"https://api.github.com/repos/yangaws/incubator-airflow/issues/3"},"comments":{"href":"https://api.github.com/repos/yangaws/incubator-airflow/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/yangaws/incubator-airflow/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/yangaws/incubator-airflow/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yangaws/incubator-airflow/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/yangaws/incubator-airflow/statuses/1c52f0df37e6be4282e682efb37a6a52799f115d"}},"author_association":"OWNER"}}
{"actor":{"display_login":"eslesar-aws"}}