|
130 | 130 | "outputs": [], |
131 | 131 | "source": [ |
132 | 132 | "%%capture\n", |
133 | | - "!curl -fsSL \"https://git.io/fhe9X\" | sh\n", |
134 | | - "try:\n", |
135 | | - " import pywren_ibm_cloud as pywren\n", |
136 | | - "except:\n", |
137 | | - " !curl -fsSL \"https://git.io/fhe9X\" | sh\n", |
138 | | - " import pywren_ibm_cloud as pywren\n", |
139 | 133 | "try:\n", |
140 | 134 | " import cv2\n", |
141 | 135 | "except:\n", |
|
150 | 144 | "import bz2" |
151 | 145 | ] |
152 | 146 | }, |
| 147 | + { |
| 148 | + "cell_type": "code", |
| 149 | + "execution_count": null, |
| 150 | + "metadata": {}, |
| 151 | + "outputs": [], |
| 152 | + "source": [ |
| 153 | + "#Install PyWren-IBM\n", |
| 154 | + "import sys\n", |
| 155 | + "sys.executable, sys.prefix\n", |
| 156 | + "!{sys.executable} -m pip install -U pywren-ibm-cloud==1.0.9" |
| 157 | + ] |
| 158 | + }, |
153 | 159 | { |
154 | 160 | "cell_type": "markdown", |
155 | 161 | "metadata": {}, |
|
349 | 355 | "outputs": [], |
350 | 356 | "source": [ |
351 | 357 | "config = {\n", |
352 | | - " 'ibm_cf': {'endpoint': '<IBM Cloud Functions Endpoint>', \n", |
353 | | - " 'namespace': '<NAMESPACE>', \n", |
354 | | - " 'api_key': '<API KEY>'}}\n", |
355 | | - "config['ibm_cos'] = {}\n", |
356 | | - "config['ibm_cos']['endpoint'] = cos_endpoint\n", |
357 | | - "config['ibm_cos']['api_key'] = cos_credentials['apikey']\n", |
358 | | - "config['pywren'] = {}\n", |
359 | | - "config['pywren']['storage_bucket'] = BUCKET" |
| 358 | + " 'ibm_cf': {'endpoint': '<IBM Cloud Functions Endpoint>',\n", |
| 359 | + " 'namespace': '<NAMESPACE>', \n", |
| 360 | + " 'action_memory' : 512,\n", |
| 361 | + " 'api_key': '<API KEY>'}, \n", |
| 362 | + " 'ibm_cos': {\n", |
| 363 | + " 'endpoint': cos_endpoint,\n", |
| 364 | + " 'api_key' : cos_credentials['apikey']\n", |
| 365 | + " },\n", |
| 366 | + " 'pywren' : {'storage_bucket' : BUCKET,\n", |
| 367 | + " 'runtime' : 'ibmfunctions/pywren-dlib-runtime:3.5'}\n", |
| 368 | + "}" |
360 | 369 | ] |
361 | 370 | }, |
362 | 371 | { |
|
366 | 375 | "The PyWren engine requires its server side component to be deployed in advance. This step creates a new IBM Cloud Functions function with the PyWren server side runtime. This action will be used internally by PyWren during execution phases." |
367 | 376 | ] |
368 | 377 | }, |
369 | | - { |
370 | | - "cell_type": "code", |
371 | | - "execution_count": null, |
372 | | - "metadata": {}, |
373 | | - "outputs": [], |
374 | | - "source": [ |
375 | | - "from pywren_ibm_cloud.deployutil import clone_runtime\n", |
376 | | - "clone_runtime('ibmfunctions/pywren-dlib-runtime:3.5', config, 'pywren-ibm-cloud')" |
377 | | - ] |
378 | | - }, |
379 | 378 | { |
380 | 379 | "cell_type": "markdown", |
381 | 380 | "metadata": {}, |
|
631 | 630 | "outputs": [], |
632 | 631 | "source": [ |
633 | 632 | "raw_images = BUCKET + '/images'\n", |
634 | | - "pw = pywren.ibm_cf_executor(config=config, runtime='pywren-dlib-runtime_3.5')\n", |
| 633 | + "pw = pywren.ibm_cf_executor(config=config)\n", |
635 | 634 | "try:\n", |
636 | 635 | " pw.map(preprocess_image, raw_images, remote_invocation=True)\n", |
637 | 636 | " results = pw.get_result()\n", |
|
0 commit comments