dd_scenario.ModelBuilder¶
-
class
dd_scenario.
ModelBuilder
(json=None, **kwargs)¶ The Model Builder class.
-
__init__
(json=None, **kwargs)¶ Creates a new Model Builder.
Examples
To create a list of
ModelBuilder
from model builder metadata of a project, for instance, the response.json() fromget_model_builders()
:>>> model_builders = [ModelBuilder(json=s) for s in client.get_model_builders()]
To create a model builder with a given name and projectId:
>>> model_builder = ModelBuilder(name="foo", projectId="aeiou")
Parameters: - json (
dict
, optional) – The dict describing the container. - client – The client that this model builder is bound to.
- **kwargs (optional) – kwargs to override container attributes.
Attributes specified here will override those of
desc
.
- json (
-
create_container
(category=None, **kwargs)¶ Creates a
Container
whose parent is this model builder.Currently supported categories are:
'inputset'
'scenario'
'model'
Example
This creates an
inputset
container with the name ‘foo’:>>> c = model_builder.create_container(category='inputset', name='foo')
Parameters: - category – The category of the container.
- **kwargs – kwargs passed to the
Container
constructor. For example, you can pass params such asname
etc..
Returns: The created
Container
-
create_scenario
(name, **kwargs)¶ Creates a new
Container
attached as a scenario of thisModelBuilder
.Parameters: - name – The name of the container.
- **kwargs – kwargs passed to the
Container
constructor.
Returns: The scenario as a
Container
Return type: Raises: NotBoundException
– when the Artifact is not bound to a client.
-
delete_container
(container)¶ Deletes the specified container
Parameters: container – The container to be deleted.
-
get_containers
(category=None, as_dict=False)¶ Returns containers of the specified category in this model builder.
Parameters: - category – The category of container. Must be
'inputset'
,'scenario'
or'model'
. - as_dict – If True, the containers are returned as a dict where its keys are the container names and its values are containers.
Returns: A list of
Container
or a dict mapping container names toContainer
- category – The category of container. Must be
-