{"action":"created","comment":{"url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/pulls/comments/54937996","id":54937996,"diff_hunk":"@@ -0,0 +1,199 @@\n+#!/usr/bin/python\n+\n+#\n+# Copyright 2016 Google Inc. All Rights Reserved.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+#    http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+\"\"\"Python sample demonstrating use of the Google Genomics Pipelines API.\n+\n+This sample demonstrates running a pipeline to compress a file that is in\n+Google Cloud Storage.\n+\n+This sample demonstrates running the pipeline in an \"ephemeral\" manner;\n+no call to pipelines.create() is neccessary. No pipeline is persisted\n+in the pipelines list.\n+\n+Usage:\n+  * python test_run_gzip.py \\\n+      --project <project-id> \\\n+      --disk-size <size-in-gb> \\\n+      --input <gcs-input-path> \\\n+      --output <gcs-output-path> \\\n+      --logging <gcs-logging-path> \\\n+      --poll-interval <interval-in-seconds>\n+\n+Where the poll-interval is optional (default is no polling).\n+\"\"\"\n+\n+import argparse\n+import pprint\n+import time\n+\n+from oauth2client.client import GoogleCredentials\n+from apiclient.discovery import build\n+\n+# Parse input args\n+parser = argparse.ArgumentParser()\n+parser.add_argument(\"--project\", required=True,\n+                    help=\"Cloud project id to run the pipeline in\")\n+parser.add_argument(\"--disk-size\", required=True, type=int,\n+                    help=\"Size (in GB) of disk for both input and output\")\n+parser.add_argument(\"--input\", required=True,\n+                    help=\"Cloud Storage path to input file\")\n+parser.add_argument(\"--output\", required=True,\n+                    help=\"Cloud Storage path to output file (with the .gz extension)\")\n+parser.add_argument(\"--logging\", required=True,\n+                    help=\"Cloud Storage path to send logging output\")\n+parser.add_argument(\"--poll-interval\", default=0, type=int,\n+                    help=\"Frequency (in seconds) to poll for completion (default: no polling)\")\n+args = parser.parse_args()\n+\n+# Create the genomics service\n+credentials = GoogleCredentials.get_application_default()\n+service = build('genomics', 'v1alpha2', credentials=credentials)\n+\n+# Run the pipeline\n+operation = service.pipelines().run(body={\n+  # The ephemeralPipeline provides the template for the pipeline\n+  # The pipelineArgs provide the inputs specific to this run\n+\n+  # There are some nuances in the API that are still being ironed out\n+  # to make this more compact.\n+\n+  'ephemeralPipeline' : {\n+    'projectId': args.project,\n+    'name': 'compress',\n+    'description': 'Run \"gzip\" on a file',\n+\n+    # Define the resources needed for this pipeline.\n+    'resources' : {\n+      # Specify default VM parameters for the pipeline\n+      'minimumCpuCores': 1,  # TODO: remove this when the API has a default\n+      'minimumRamGb': 3.75, # TODO: remove this when the API has a default\n+\n+      # Create a data disk that is attached to the VM and destroyed when the\n+      # pipeline terminates.\n+      'disks': [ {\n+        'name': 'data',\n+        'autoDelete': True,\n+\n+        # Within the docker container, specify a mount point for the disk.\n+        # The pipeline input argument below will specify that inputs should be\n+        # written to this disk.\n+        'mountPoint': '/mnt/data',\n+\n+        # Specify a default size and type","path":"compress/test/cloud/test_run_gzip.py","position":96,"original_position":96,"commit_id":"e6b08d75a1832856d20760771ddbf522e9d422fd","original_commit_id":"6f2f99a1848f178246cd9dfbaffd9934cf08577c","user":{"login":"mbookman","id":5818294,"avatar_url":"https://avatars.githubusercontent.com/u/5818294?v=3","gravatar_id":"","url":"https://api.github.com/users/mbookman","html_url":"https://github.com/mbookman","followers_url":"https://api.github.com/users/mbookman/followers","following_url":"https://api.github.com/users/mbookman/following{/other_user}","gists_url":"https://api.github.com/users/mbookman/gists{/gist_id}","starred_url":"https://api.github.com/users/mbookman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbookman/subscriptions","organizations_url":"https://api.github.com/users/mbookman/orgs","repos_url":"https://api.github.com/users/mbookman/repos","events_url":"https://api.github.com/users/mbookman/events{/privacy}","received_events_url":"https://api.github.com/users/mbookman/received_events","type":"User","site_admin":false},"body":"Thanks- fixed them to be consistent with single-sentence comments omitting periods and mutli-sentence comments using periods.","created_at":"2016-03-03T19:55:57Z","updated_at":"2016-03-03T19:55:57Z","html_url":"https://github.com/googlegenomics/pipelines-api-examples/pull/9#discussion_r54937996","pull_request_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/pulls/comments/54937996"},"html":{"href":"https://github.com/googlegenomics/pipelines-api-examples/pull/9#discussion_r54937996"},"pull_request":{"href":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/pulls/9","id":61605972,"html_url":"https://github.com/googlegenomics/pipelines-api-examples/pull/9","diff_url":"https://github.com/googlegenomics/pipelines-api-examples/pull/9.diff","patch_url":"https://github.com/googlegenomics/pipelines-api-examples/pull/9.patch","issue_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/issues/9","number":9,"state":"open","locked":false,"title":"Adds a pipeline example for compressing a file in Cloud Storage","user":{"login":"mbookman","id":5818294,"avatar_url":"https://avatars.githubusercontent.com/u/5818294?v=3","gravatar_id":"","url":"https://api.github.com/users/mbookman","html_url":"https://github.com/mbookman","followers_url":"https://api.github.com/users/mbookman/followers","following_url":"https://api.github.com/users/mbookman/following{/other_user}","gists_url":"https://api.github.com/users/mbookman/gists{/gist_id}","starred_url":"https://api.github.com/users/mbookman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbookman/subscriptions","organizations_url":"https://api.github.com/users/mbookman/orgs","repos_url":"https://api.github.com/users/mbookman/repos","events_url":"https://api.github.com/users/mbookman/events{/privacy}","received_events_url":"https://api.github.com/users/mbookman/received_events","type":"User","site_admin":false},"body":"Also provides an example of an ephemeral pipeline.","created_at":"2016-03-03T18:49:11Z","updated_at":"2016-03-03T19:55:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5bbedf4f6d4f5c8726399a889a095611a945723e","assignee":{"login":"deflaux","id":1395500,"avatar_url":"https://avatars.githubusercontent.com/u/1395500?v=3","gravatar_id":"","url":"https://api.github.com/users/deflaux","html_url":"https://github.com/deflaux","followers_url":"https://api.github.com/users/deflaux/followers","following_url":"https://api.github.com/users/deflaux/following{/other_user}","gists_url":"https://api.github.com/users/deflaux/gists{/gist_id}","starred_url":"https://api.github.com/users/deflaux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deflaux/subscriptions","organizations_url":"https://api.github.com/users/deflaux/orgs","repos_url":"https://api.github.com/users/deflaux/repos","events_url":"https://api.github.com/users/deflaux/events{/privacy}","received_events_url":"https://api.github.com/users/deflaux/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/pulls/9/commits","review_comments_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/pulls/9/comments","review_comment_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/pulls/comments{/number}","comments_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/issues/9/comments","statuses_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/statuses/e6b08d75a1832856d20760771ddbf522e9d422fd","head":{"label":"mbookman:master","ref":"master","sha":"e6b08d75a1832856d20760771ddbf522e9d422fd","user":{"login":"mbookman","id":5818294,"avatar_url":"https://avatars.githubusercontent.com/u/5818294?v=3","gravatar_id":"","url":"https://api.github.com/users/mbookman","html_url":"https://github.com/mbookman","followers_url":"https://api.github.com/users/mbookman/followers","following_url":"https://api.github.com/users/mbookman/following{/other_user}","gists_url":"https://api.github.com/users/mbookman/gists{/gist_id}","starred_url":"https://api.github.com/users/mbookman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbookman/subscriptions","organizations_url":"https://api.github.com/users/mbookman/orgs","repos_url":"https://api.github.com/users/mbookman/repos","events_url":"https://api.github.com/users/mbookman/events{/privacy}","received_events_url":"https://api.github.com/users/mbookman/received_events","type":"User","site_admin":false},"repo":{"id":52829203,"name":"pipelines-api-examples","full_name":"mbookman/pipelines-api-examples","owner":{"login":"mbookman","id":5818294,"avatar_url":"https://avatars.githubusercontent.com/u/5818294?v=3","gravatar_id":"","url":"https://api.github.com/users/mbookman","html_url":"https://github.com/mbookman","followers_url":"https://api.github.com/users/mbookman/followers","following_url":"https://api.github.com/users/mbookman/following{/other_user}","gists_url":"https://api.github.com/users/mbookman/gists{/gist_id}","starred_url":"https://api.github.com/users/mbookman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbookman/subscriptions","organizations_url":"https://api.github.com/users/mbookman/orgs","repos_url":"https://api.github.com/users/mbookman/repos","events_url":"https://api.github.com/users/mbookman/events{/privacy}","received_events_url":"https://api.github.com/users/mbookman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mbookman/pipelines-api-examples","description":"Examples for the Google Genomics Pipelines API.","fork":true,"url":"https://api.github.com/repos/mbookman/pipelines-api-examples","forks_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/forks","keys_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/teams","hooks_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/hooks","issue_events_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/issues/events{/number}","events_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/events","assignees_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/assignees{/user}","branches_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/branches{/branch}","tags_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/tags","blobs_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/git/refs{/sha}","trees_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/statuses/{sha}","languages_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/languages","stargazers_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/stargazers","contributors_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/contributors","subscribers_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/subscribers","subscription_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/subscription","commits_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/commits{/sha}","git_commits_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/git/commits{/sha}","comments_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/comments{/number}","issue_comment_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/issues/comments{/number}","contents_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/contents/{+path}","compare_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/merges","archive_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/downloads","issues_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/issues{/number}","pulls_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/pulls{/number}","milestones_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/milestones{/number}","notifications_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/labels{/name}","releases_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/releases{/id}","deployments_url":"https://api.github.com/repos/mbookman/pipelines-api-examples/deployments","created_at":"2016-02-29T22:21:21Z","updated_at":"2016-03-01T01:33:21Z","pushed_at":"2016-03-03T19:27:32Z","git_url":"git://github.com/mbookman/pipelines-api-examples.git","ssh_url":"git@github.com:mbookman/pipelines-api-examples.git","clone_url":"https://github.com/mbookman/pipelines-api-examples.git","svn_url":"https://github.com/mbookman/pipelines-api-examples","homepage":"","size":22,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"googlegenomics:master","ref":"master","sha":"302ad6797fe05a10603a8e99d5b4596de4bbbfd6","user":{"login":"googlegenomics","id":7434120,"avatar_url":"https://avatars.githubusercontent.com/u/7434120?v=3","gravatar_id":"","url":"https://api.github.com/users/googlegenomics","html_url":"https://github.com/googlegenomics","followers_url":"https://api.github.com/users/googlegenomics/followers","following_url":"https://api.github.com/users/googlegenomics/following{/other_user}","gists_url":"https://api.github.com/users/googlegenomics/gists{/gist_id}","starred_url":"https://api.github.com/users/googlegenomics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/googlegenomics/subscriptions","organizations_url":"https://api.github.com/users/googlegenomics/orgs","repos_url":"https://api.github.com/users/googlegenomics/repos","events_url":"https://api.github.com/users/googlegenomics/events{/privacy}","received_events_url":"https://api.github.com/users/googlegenomics/received_events","type":"Organization","site_admin":false},"repo":{"id":50465020,"name":"pipelines-api-examples","full_name":"googlegenomics/pipelines-api-examples","owner":{"login":"googlegenomics","id":7434120,"avatar_url":"https://avatars.githubusercontent.com/u/7434120?v=3","gravatar_id":"","url":"https://api.github.com/users/googlegenomics","html_url":"https://github.com/googlegenomics","followers_url":"https://api.github.com/users/googlegenomics/followers","following_url":"https://api.github.com/users/googlegenomics/following{/other_user}","gists_url":"https://api.github.com/users/googlegenomics/gists{/gist_id}","starred_url":"https://api.github.com/users/googlegenomics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/googlegenomics/subscriptions","organizations_url":"https://api.github.com/users/googlegenomics/orgs","repos_url":"https://api.github.com/users/googlegenomics/repos","events_url":"https://api.github.com/users/googlegenomics/events{/privacy}","received_events_url":"https://api.github.com/users/googlegenomics/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/googlegenomics/pipelines-api-examples","description":"Examples for the Google Genomics Pipelines API.","fork":false,"url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples","forks_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/forks","keys_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/teams","hooks_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/hooks","issue_events_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/issues/events{/number}","events_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/events","assignees_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/assignees{/user}","branches_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/branches{/branch}","tags_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/tags","blobs_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/git/refs{/sha}","trees_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/statuses/{sha}","languages_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/languages","stargazers_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/stargazers","contributors_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/contributors","subscribers_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/subscribers","subscription_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/subscription","commits_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/commits{/sha}","git_commits_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/git/commits{/sha}","comments_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/comments{/number}","issue_comment_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/issues/comments{/number}","contents_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/contents/{+path}","compare_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/merges","archive_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/downloads","issues_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/issues{/number}","pulls_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/pulls{/number}","milestones_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/milestones{/number}","notifications_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/labels{/name}","releases_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/releases{/id}","deployments_url":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/deployments","created_at":"2016-01-26T22:48:30Z","updated_at":"2016-02-19T21:16:02Z","pushed_at":"2016-03-03T19:27:33Z","git_url":"git://github.com/googlegenomics/pipelines-api-examples.git","ssh_url":"git@github.com:googlegenomics/pipelines-api-examples.git","clone_url":"https://github.com/googlegenomics/pipelines-api-examples.git","svn_url":"https://github.com/googlegenomics/pipelines-api-examples","homepage":"","size":16,"stargazers_count":1,"watchers_count":1,"language":"Shell","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":5,"forks":2,"open_issues":5,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/pulls/9"},"html":{"href":"https://github.com/googlegenomics/pipelines-api-examples/pull/9"},"issue":{"href":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/issues/9"},"comments":{"href":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/googlegenomics/pipelines-api-examples/statuses/e6b08d75a1832856d20760771ddbf522e9d422fd"}}}}