...
Markdown |
---|
#### Python Source code: ``` python #! /usr/bin/env python import os import pwd import imas if __name__ == '__main__': uid = os.getuid() pw = pwd.getpwuid(uid) pulsefile = imas.ids(1, 1) pulsefile.create_env(pw.pw_name, 'test', '3') summary = pulsefile.summary summary.ids_properties.comment = 'Hello World from Python' summary.ids_properties.homogeneous_time = 1 summary.time.resize(1) summary.time[0] = 0.1 summary.put() pulsefile.close() ``` |
Markdown |
---|
### Data transfer
- There are two approaches to transfer data to and from the container
- The first one uses `docker cp` which can copy files from the host to
the container or vice versa
- Create the container with a meaningful name using
`--name <NAME>` parameter added to `docker run` command:
``` sh
docker run -it --name demo imas/ual
```
- To copy one file at a time:
``` sh
docker cp ids_10001.characteristics demo:/root/public/imasdb/test/3/0/
docker cp ids_10001.datafile demo:/root/public/imasdb/test/3/0/
docker cp ids_10001.tree demo:/root/public/imasdb/test/3/0/
```
- To copy more files/directories at once:
``` sh
tar c ids_10001.* | docker cp - demo:/root/public/imasdb/test/3/0/
``` |
Markdown |
---|
- The second approach uses volumes i.e., a mapping of a local
directory (which must be provided as an absolute path) to a
container path
- Start the container with
`--volume <LOCAL_PATH>:<CONTAINER_PATH>` parameter added to
`docker run` command
``` sh
docker run -it --volume $(pwd):/root/public/imasdb/test/3/0 imas/ual
```
- The volume approach is recommended as it allows a seamless two-way
transfer between the host and the container |