¿How can we crate a lambda which uses a Braket D-Wave device?

0

We are trying to deploy a Lambda with some code which works in a Notebook. The code is rather simple and uses D-Wave — DW_2000Q_6. The problem is that when we execute the lambda (container lambda due to size problems), it give us the following error:

{
  "errorMessage": "[Errno 30] Read-only file system: '/home/sbx_user1051'",
  "errorType": "OSError",
  "stackTrace": [
    "  File \"/var/lang/lib/python3.8/imp.py\", line 234, in load_module\n    return load_source(name, filename, file)\n",
    "  File \"/var/lang/lib/python3.8/imp.py\", line 171, in load_source\n    module = _load(spec)\n",
    "  File \"<frozen importlib._bootstrap>\", line 702, in _load\n",
    "  File \"<frozen importlib._bootstrap>\", line 671, in _load_unlocked\n",
    "  File \"<frozen importlib._bootstrap_external>\", line 843, in exec_module\n",
    "  File \"<frozen importlib._bootstrap>\", line 219, in _call_with_frames_removed\n",
    "  File \"/var/task/lambda_function.py\", line 6, in <module>\n    from dwave.system.composites import EmbeddingComposite\n",
    "  File \"/var/task/dwave/system/__init__.py\", line 15, in <module>\n    import dwave.system.flux_bias_offsets\n",
    "  File \"/var/task/dwave/system/flux_bias_offsets.py\", line 22, in <module>\n    from dwave.system.samplers.dwave_sampler import DWaveSampler\n",
    "  File \"/var/task/dwave/system/samplers/__init__.py\", line 15, in <module>\n    from dwave.system.samplers.clique import *\n",
    "  File \"/var/task/dwave/system/samplers/clique.py\", line 32, in <module>\n    from dwave.system.samplers.dwave_sampler import DWaveSampler, _failover\n",
    "  File \"/var/task/dwave/system/samplers/dwave_sampler.py\", line 31, in <module>\n    from dwave.cloud import Client\n",
    "  File \"/var/task/dwave/cloud/__init__.py\", line 21, in <module>\n    from dwave.cloud.client import Client\n",
    "  File \"/var/task/dwave/cloud/client/__init__.py\", line 17, in <module>\n    from dwave.cloud.client.base import Client\n",
    "  File \"/var/task/dwave/cloud/client/base.py\", line 89, in <module>\n    class Client(object):\n",
    "  File \"/var/task/dwave/cloud/client/base.py\", line 736, in Client\n    @cached.ondisk(maxage=_REGIONS_CACHE_MAXAGE)\n",
    "  File \"/var/task/dwave/cloud/utils.py\", line 477, in ondisk\n    directory = kwargs.pop('directory', get_cache_dir())\n",
    "  File \"/var/task/dwave/cloud/config.py\", line 455, in get_cache_dir\n    return homebase.user_cache_dir(\n",
    "  File \"/var/task/homebase/homebase.py\", line 150, in user_cache_dir\n    return _get_folder(True, _FolderTypes.cache, app_name, app_author, version, False, use_virtualenv, create)[0]\n",
    "  File \"/var/task/homebase/homebase.py\", line 430, in _get_folder\n    os.makedirs(final_path)\n",
    "  File \"/var/lang/lib/python3.8/os.py\", line 213, in makedirs\n    makedirs(head, exist_ok=exist_ok)\n",
    "  File \"/var/lang/lib/python3.8/os.py\", line 213, in makedirs\n    makedirs(head, exist_ok=exist_ok)\n",
    "  File \"/var/lang/lib/python3.8/os.py\", line 223, in makedirs\n    mkdir(name, mode)\n"
  ]
}

It seems that the library tries to write to some files which are not in /tmp folder.

I'm wondering if is possible to do this, and if not, what are the alternatives.

imports used:

import boto3
from braket.ocean_plugin import BraketDWaveSampler
from dwave.system.composites import EmbeddingComposite
from neal import SimulatedAnnealingSampler
1 Answer
0

Hi, and thank you very much for your question!

As you noted, AWS Lambda allows for writing in the /tmp folder and the dwave determines where it will cache data based on this algorithm.

We currently support running Braket in Notebook Instances you can create through our console, or as Braket Hybrid Jobs, which is more similar to your use of containers.

However, we would really appreciate to understand more about your use case to see if that's something we should look into more deeply. Could you please give us more information about your use case, what you're trying to do, and why you think AWS Lambda will work well for it?

AWS
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions