Skip to main content

How-to: Export and Import Container Objects

Issue:

Is it possible to export a container objects created from models, and have them imported during make install?

Solution:

Yes, it is possible to export a container using esp export container <container name> > new_container.yml

In order to enable importing the file during make install, the container file must be added to roles/seed/content.yml

19298884551315-mceclip0.png

The exported new_container.yml would be similar to the one below:

19298894495251-mceclip1.png

Case 1: Container to be exported is Empty (i.e. no entities are filled inside the container)

  • ESP will throw an exception ValueError: Must provide either a single item, a single slot, or equal-length lists of both. Found len(slots): 0; len(items): 0; len(fields): 1

    • ESP requires the container to hold an entity object (an entity such as a sample etc or another container) when the keyword fill (line no 3) is used

  • Use the keyword slots instead

19298944309011-mceclip2.png
  • Alternatively, the keyword slots or fill can be commented as well in this case, only the indentation in the rest of the yml file needs to corrected

Case 2: Container to be exported is loaded with entity (Eg: Generic Sample, Plant, Seed, DNA, etc)

  • The exported container can be imported as is

  • No changes in the yml file is required

Case 3: Container to be exported is loaded with a container (Eg: Freezer, Well Plate, Box, Shelf, etc)

  • ESP will throw an exception ValueError: Container creation requires container_type key.

  • ESP is unable to find the container_type of the container object loaded in the main container

  • Hence, user must explicitly mention the container_type along with the container object (shown below)

    • Please note - the colon ‘:' after the ‘Small Box 1’ container and the indentation before type in the next line is not to be missed19298978500883-mceclip3.png