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
ModelBuilderfrom 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
Containerwhose parent is this model builder.Currently supported categories are:
'inputset''scenario''model'
Example
This creates an
inputsetcontainer 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
Containerconstructor. For example, you can pass params such asnameetc..
Returns: The created
Container
-
create_scenario(name, **kwargs)¶ Creates a new
Containerattached as a scenario of thisModelBuilder.Parameters: - name – The name of the container.
- **kwargs – kwargs passed to the
Containerconstructor.
Returns: The scenario as a
ContainerReturn 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
Containeror a dict mapping container names toContainer- category – The category of container. Must be
-