Created
July 20, 2021 09:07
-
-
Save alimanfoo/3b8645ad4927588f3f493d6748d51eb0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"id": "c4706a64-fb36-410a-8a65-042540798b73", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"'0.7.2'" | |
] | |
}, | |
"execution_count": 1, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"import gcsfs\n", | |
"gcsfs.__version__" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"id": "99178f0c-d9bf-49e9-99d8-926c8ae94b2d", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# one-time browser authentication, will save token to ~/.gcs_tokens file\n", | |
"# gcsfs.core.client_config['installed']['client_id'] = '160816776314-7h1p2h6bqhe77vs1su4rr22fblso9dre.apps.googleusercontent.com'\n", | |
"# gcsfs.core.client_config['installed']['client_secret'] = 'SrJUwD58yKgViyJtw-NP2sz8'\n", | |
"# gcs_browser = gcsfs.GCSFileSystem(project='malariagen-jupyterhub', token='browser')" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"id": "9253e241-c103-4b51-9c51-6244e69448eb", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"gcs_cache = gcsfs.GCSFileSystem(project='malariagen-jupyterhub', token='cache')\n", | |
"gcs = gcsfs.GCSFileSystem(project='malariagen-jupyterhub', token=gcs_cache.credentials, cache_timeout=0)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"id": "f66eb70f-3d63-4bbf-8153-38318dd8ff56", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"['vo_agam_production/accessibility_maps',\n", | |
" 'vo_agam_production/accessibility_summary_stats',\n", | |
" 'vo_agam_production/ag3_data_paper',\n", | |
" 'vo_agam_production/ancestry_informative_marker_defs',\n", | |
" 'vo_agam_production/cnv',\n", | |
" 'vo_agam_production/crosses_analysis',\n", | |
" 'vo_agam_production/crosses_stats',\n", | |
" 'vo_agam_production/machine_learning',\n", | |
" 'vo_agam_production/phasing-validation',\n", | |
" 'vo_agam_production/resources',\n", | |
" 'vo_agam_production/test.txt',\n", | |
" 'vo_agam_production/test_locks',\n", | |
" 'vo_agam_production/tracking',\n", | |
" 'vo_agam_production/v3.x']" | |
] | |
}, | |
"execution_count": 4, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"gcs.ls(\"vo_agam_production\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"id": "f0d2c99b-c2f8-47fc-bbac-204cb7c2f1df", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"hello world again\n", | |
"\n" | |
] | |
} | |
], | |
"source": [ | |
"with gcs.open(\"vo_agam_production/test.txt\", mode=\"rt\") as f:\n", | |
" print(f.read())" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"id": "857ec04b-2879-4e3c-8527-1c009bd4665a", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"with gcs.open(\"vo_agam_production/test.txt\", mode=\"wt\") as f:\n", | |
" print(\"alimanfoo was here\", file=f)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "44b535d5-e1f2-463a-8fb0-6e7f479905b2", | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python [conda env:binder-v3.0.0]", | |
"language": "python", | |
"name": "conda-env-binder-v3.0.0-py" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.7.0" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment