Attempts at using PyDAOS
Alex Barcelo
I have a DAOS installation for evaluation/exploration and I was trying to make the Python bindings work. My first contact with PyDAOS is at the official documentation https://daos-stack.github.io/user/interface/#python-bindings which talks about a "DAOS key-value store API with python dictionnaries[sic]" but doesn't give any example about how to create that object (or am I missing something obvious?). I decided to move to something more elemental and play around the pydaos.raw bindings, seeing that there is some example here: https://github.com/daos-stack/daos/blob/master/src/client/pydaos/raw/README.md The
Otherwise I get a The problem I have not been able to solve is the following: When I reach the
I know that the problem is related to my non-root installation where instead of using /var/run/daos* I am using another folder (I figured that much in the logs with the line Of course I am missing some configuration step. Which configuration step am I missing? Where should I configure the non-default /var/run/daos_agent alternative path? Or am I doing something inappropriate? |
|
Pittman, Ashley M
Alex,
Can you elaborate on what it is you’re trying to achieve? There are really two parts to the python bindings, there’s pydaos.raw which is using ctypes to open the daos client shared library from python, this is mostly used in the testing to create containers and do any setup for testing, or simply as a quick way to invoke the DAOS API.
The second part of the python binding is pydaos itself, which is a python module which is in part written in C and is a direct client of daos, it’s here that we’re concentrating most of the work on DAOS clients (as opposed to tools/setup) and this is where the key/value store is accessed. For this you should look at the KVObj() object, which exports a dict like object, which can also support bulk put/get. Also included but scheduled for overhaul and partial removal is the daosdbm module which is in the source tree but not installed, the daos_named_kv() object here is the one to look at for one way to import daos and open multiple kv stores by name.
https://github.com/daos-stack/daos/blob/master/src/client/pydaos/pydaos_core.py#L235 https://github.com/daos-stack/daos/blob/master/src/client/pydaos/daosdbm.py#L30-L72
Nothing has changed in this area in the last month, but there is work to change how daos_init() is called from within pydaos which will affect and hopefully improve the way the module is imported, but that’s still work-in-progress.
I’ll file a ticket and resolve the spelling errors in the codebase/documentation..
Ashley,
From:
<daos@daos.groups.io> on behalf of "Alex Barcelo via groups.io" <alex@...>
I have a DAOS installation for evaluation/exploration and I was trying to make the Python bindings work. My first contact with PyDAOS is at the official documentation https://daos-stack.github.io/user/interface/#python-bindings which talks about a "DAOS key-value store API with python dictionnaries[sic]" but doesn't give any example about how to create that object (or am I missing something obvious?). I decided to move to something more elemental and play around the pydaos.raw bindings, seeing that there is some example here: https://github.com/daos-stack/daos/blob/master/src/client/pydaos/raw/README.md The
Otherwise I get a The problem I have not been able to solve is the following: When I reach the
I know that the problem is related to my non-root installation where instead of using /var/run/daos* I am using another folder (I figured that much in the logs with the line
Of course I am missing some configuration step. Which configuration step am I missing? Where should I configure the non-default /var/run/daos_agent alternative path? Or am I doing something inappropriate? --------------------------------------------------------------------- This e-mail and any attachments may contain confidential material for |
|
Alex Barcelo
Ok, regarding KVObj, my naive attempt was:
And that obviously fails due to missing positional arguments. I didn't realize on the factory-like mechanisms through the Even if I get the KV interface to work, wouldn't I have the same issues with the broken socket which I am already having while trying pydaos.raw? Or are there some key differences between both of them? Should I configure the /var/run/daos_agent path somewhere? Why can I do things like pool creation through CLI but the Python pydaos.raw break? On the "what I am trying to achieve": I want to "validate" (for lack of a better word) that the installation of DAOS I have in our development machine is correct and is using properly its OptaneDC PMM --that is the only deviation from the single-server defaults I have consciously introduced in my installation so far. For now, I have been able to build DAOS in the machine and start all the DAOS services, but I haven't managed to use it from application space yet. And PyDAOS seemed a good way to proceed, is it? |
|
Pittman, Ashley M
The easiest way, assuming you want a single KV per container is to do the following:
import pydaos cont = pydaos.cont(‘<pool_uuid>’, ‘<container_uuid>’) kv = cont.root_kv() kv[‘key’] = value
If you want multiple kvs per container then you have to do something like daos_named_kv and store the name ó object_id translation in the root kv, or you can call cont.newkv() to create a new key-value store, and save kv.oid.lo and kv.oid.hi out-of-band, reopening the kv later on with kv = cont.kv(pydaos.OjbID(lo, hi).
The issues with the socket come from non-default install paths, but this is OK, you need to set DAOS_AGENT_DRPC_DIR to the directory that your agent was started with, as documented here https://daos-stack.github.io/admin/deployment/ I assume you have the agent and server already running?
Ashley.
From:
<daos@daos.groups.io> on behalf of "Alex Barcelo via groups.io" <alex@...>
Ok, regarding KVObj, my naive attempt was:
And that obviously fails due to missing positional arguments. I didn't realize on the factory-like mechanisms through the
Even if I get the KV interface to work, wouldn't I have the same issues with the broken socket which I am already having while trying pydaos.raw? Or are there some key differences between both of them? Should I configure the /var/run/daos_agent path somewhere? Why can I do things like pool creation through CLI but the Python pydaos.raw break? On the "what I am trying to achieve": I want to "validate" (for lack of a better word) that the installation of DAOS I have in our development machine is correct and is using properly its OptaneDC PMM --that is the only deviation from the single-server defaults I have consciously introduced in my installation so far. For now, I have been able to build DAOS in the machine and start all the DAOS services, but I haven't managed to use it from application space yet. And PyDAOS seemed a good way to proceed, is it? --------------------------------------------------------------------- This e-mail and any attachments may contain confidential material for |
|
Alex Barcelo
Thanks, I didn't know about I completely missed that section on the deployment documentation, shame on me. I was definetely looking at the wrong places, thanks for pointing that out! I have both the server and the agent running, and thanks to your pointers I have been able to create a key-value from Python and use it. My success full steps:
|
|
Pittman, Ashley M
That looks much better. You should be aware that daos will be using a byte-array for the values, so in this case 42 will be a string, not a integer. It’s likely that you’d want to use pickle/unpickle complex values before storing them.
Ashley.
From:
<daos@daos.groups.io> on behalf of "Alex Barcelo via groups.io" <alex@...>
Thanks, I didn't know about I completely missed that section on the deployment documentation, shame on me. I was definetely looking at the wrong places, thanks for pointing that out! I have both the server and the agent running, and thanks to your pointers I have been able to create a key-value from Python and use it. My success full steps:
--------------------------------------------------------------------- This e-mail and any attachments may contain confidential material for |
|