(instance_template_data, session)
| 325 | |
| 326 | |
| 327 | def create_instance_template(instance_template_data, session): |
| 328 | instance_template = InstanceTemplate( |
| 329 | name = instance_template_data.get('name', ''), |
| 330 | project_id = instance_template_data.get('project_id'), |
| 331 | status = instance_template_data.get('status') |
| 332 | ) |
| 333 | session.add(instance_template) |
| 334 | regular_methods.commit_with_rollback(session) |
| 335 | if instance_template_data.get('instance_list', None): |
| 336 | for instance in instance_template_data.get('instance_list'): |
| 337 | new_instance = create_instance( |
| 338 | instance_data = instance, |
| 339 | session = session |
| 340 | ) |
| 341 | rel = InstanceTemplateRelation( |
| 342 | instance_template_id = instance_template.id, |
| 343 | instance_id = new_instance.id |
| 344 | ) |
| 345 | session.add(rel) |
| 346 | if instance_template_data.get('schema_id'): |
| 347 | schema = LabelSchema.get_by_id(session, instance_template_data.get('schema_id'), |
| 348 | project_id = instance_template_data.get('project_id')) |
| 349 | schema.add_instance_template(session = session, |
| 350 | instance_template_id = instance_template.id, |
| 351 | member_created_id = schema.member_created_id) |
| 352 | regular_methods.commit_with_rollback(session) |
| 353 | return instance_template |
| 354 | |
| 355 | |
| 356 | def create_user(user_data, session): |
nothing calls this directly
no test coverage detected