Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions component-library/util/util-cos.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"\n",
"#os.environ['create_image']='True'\n",
"os.environ['repository']='docker.io/romeokienzler'\n",
"os.environ['version']='0.2'\n",
"os.environ['version']='0.3'\n",
"os.environ['name']='claimed-util-cos'"
]
},
Expand All @@ -72,6 +72,7 @@
" RUN apt update && apt install -y python3-pip procps default-jre\n",
" RUN pip install ipython nbformat aiobotocore botocore s3fs\n",
" ADD util-cos.ipynb .\n",
" CMD [\"ipython\", \"util-cos.ipynb\"]\n",
" \"\"\"\n",
" with open(\"Dockerfile\", \"w\") as text_file:\n",
" text_file.write(docker_file)\n",
Expand Down Expand Up @@ -135,6 +136,9 @@
"# cos bucket name\n",
"bucket_name = os.environ.get('bucket_name')\n",
"\n",
"# path\n",
"path = os.environ.get('path','')\n",
"\n",
"# operation\n",
"operation = os.environ.get('operation')"
]
Expand Down Expand Up @@ -170,6 +174,18 @@
" exec(parameter)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b0e2aec4",
"metadata": {},
"outputs": [],
"source": [
"def print_list(l):\n",
" for file in l:\n",
" print(file)"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -193,8 +209,12 @@
" client_kwargs={'endpoint_url': endpoint}\n",
")\n",
"\n",
"if operation == 'mkbucket':\n",
" s3.mkdir(bucket_name)\n",
"if operation == 'mkdir':\n",
" s3.mkdir(bucket_name+path)\n",
"elif operation == 'ls':\n",
" print_list(s3.ls(bucket_name+path))\n",
"elif operation == 'find':\n",
" print_list(s3.find(bucket_name+path))\n",
"else:\n",
" print(f'operation unkonwn {operation}')"
]
Expand Down