omni.flux.validator.mass.core#

  • SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

  • SPDX-License-Identifier: Apache-2.0

  • Licensed under the Apache License, Version 2.0 (the “License”);

  • you may not use this file except in compliance with the License.

  • You may obtain a copy of the License at

  • https://www.apache.org/licenses/LICENSE-2.0

  • Unless required by applicable law or agreed to in writing, software

  • distributed under the License is distributed on an “AS IS” BASIS,

  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  • See the License for the specific language governing permissions and

  • limitations under the License.

omni.flux.validator.mass.core.cli.main()#
async omni.flux.validator.mass.core.cli.run(
json_paths: List[str],
executor: int,
print_result: bool,
silent: bool,
timeout: int | None = None,
)#
  • SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

  • SPDX-License-Identifier: Apache-2.0

  • Licensed under the Apache License, Version 2.0 (the “License”);

  • you may not use this file except in compliance with the License.

  • You may obtain a copy of the License at

  • https://www.apache.org/licenses/LICENSE-2.0

  • Unless required by applicable law or agreed to in writing, software

  • distributed under the License is distributed on an “AS IS” BASIS,

  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  • See the License for the specific language governing permissions and

  • limitations under the License.

class omni.flux.validator.mass.core.manager.CurrentProcessExecutor(max_concurrent: int = 1)#

Bases: BaseExecutor

submit(
core: _ManagerCore,
print_result: bool = False,
silent: bool = False,
timeout: int | None = None,
standalone: bool | None = False,
queue_id: str | None = None,
) Future#

Submit and execute a job

Parameters:
  • core – the manager core that holds the data

  • print_result – print the resulting schema or not

  • silent – print the stdout or not

  • timeout – timeout for each job

  • standalone – does the process run in a standalone mode or not (like a CLI)

  • queue_id – the queue ID to use. Needed if you have multiple widgets that shows different queues

Returns:

The future of the job (that will hold the result)

class omni.flux.validator.mass.core.manager.Executors(value)#

Bases: IntEnum

An enumeration.

CURRENT_PROCESS_EXECUTOR = 0#
EXTERNAL_PROCESS_EXECUTOR = 1#
classmethod get_names()#
class omni.flux.validator.mass.core.manager.ExternalProcessExecutor#

Bases: BaseExecutor

create_ui()#
submit(
core: _ManagerCore,
print_result: bool = False,
silent: bool = False,
timeout: int | None = None,
standalone: bool | None = False,
queue_id: str | None = None,
)#

Submit and execute a job

Parameters:
  • core – the manager core that holds the data

  • print_result – print the resulting schema or not

  • silent – print the stdout or not

  • timeout – timeout for each job

  • standalone – does the process run in a standalone mode or not (like a CLI)

  • queue_id – the queue ID to use. Needed if you have multiple widgets that shows different queues

Returns:

The future of the job (that will hold the result)

class omni.flux.validator.mass.core.manager.ManagerMassCore(
schema_paths: List[str] | None = None,
schema_dicts: List[dict] | None = None,
standalone: bool = False,
)#

Bases: object

add_schemas(
schemas: List[Dict[Any, Any]],
)#

Add schema as an item to run

Parameters:

schemas – the schema dictionary

async create_tasks(
executor: Executors,
data: List[Dict[Any, Any]],
custom_executors: Tuple[CurrentProcessExecutor, ExternalProcessExecutor] | None = None,
print_result: bool = False,
silent: bool = False,
timeout: int | None = None,
standalone: bool | None = False,
queue_id: str | None = None,
) List[Tuple[ManagerCore, Future]]#

Run the validation using the current schema

Parameters:
  • executor – the executor used to select an actual executor with int index

  • data – list of schemas to run

  • custom_executors – optional override executors

  • print_result – print the result or not into stdout

  • silent – silent the stdout

  • timeout – the maximum time a task should take

  • standalone – does the process run in a standalone mode or not (like a CLI)

  • queue_id – the queue ID to use. Needed if you have multiple widgets that shows different queues

Returns:

The created core validation manager + the corresponding task

async create_tasks_with_exception(
executor: Executors,
data: List[Dict[Any, Any]],
print_result: bool = False,
silent: bool = False,
) List[Tuple[ManagerCore, Future]]#

Run the validation using the current schema

Parameters:
  • executor – the executor to use

  • data – list of schemas to run

  • print_result – print the result or not into stdout

  • silent – silent the stdout

destroy()#
property schema_model: Model#

Return the model that contain all the added validation schema

subscribe_core_added(
callback: Callable[[ManagerCore], Any],
)#

Return the object that will automatically unsubscribe when destroyed.

subscribe_run_finished(
callback: Callable[[ManagerCore, int, int, bool, str | None], Any],
)#

Return the object that will automatically unsubscribe when destroyed.

  • SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

  • SPDX-License-Identifier: Apache-2.0

  • Licensed under the Apache License, Version 2.0 (the “License”);

  • you may not use this file except in compliance with the License.

  • You may obtain a copy of the License at

  • https://www.apache.org/licenses/LICENSE-2.0

  • Unless required by applicable law or agreed to in writing, software

  • distributed under the License is distributed on an “AS IS” BASIS,

  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  • See the License for the specific language governing permissions and

  • limitations under the License.

class omni.flux.validator.mass.core.data_models.enums.Executors(value)#

Bases: IntEnum

An enumeration.

CURRENT_PROCESS_EXECUTOR = 0#
EXTERNAL_PROCESS_EXECUTOR = 1#
classmethod get_names()#
  • SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

  • SPDX-License-Identifier: Apache-2.0

  • Licensed under the Apache License, Version 2.0 (the “License”);

  • you may not use this file except in compliance with the License.

  • You may obtain a copy of the License at

  • https://www.apache.org/licenses/LICENSE-2.0

  • Unless required by applicable law or agreed to in writing, software

  • distributed under the License is distributed on an “AS IS” BASIS,

  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  • See the License for the specific language governing permissions and

  • limitations under the License.

pydantic model omni.flux.validator.mass.core.data_models.models.MassValidationResponseModel#

Bases: BaseServiceModel

Show JSON schema
{
   "title": "MassValidationResponseModel",
   "type": "object",
   "properties": {
      "completed_schemas": {
         "items": {
            "additionalProperties": true,
            "type": "object"
         },
         "title": "Completed Schemas",
         "type": "array"
      }
   },
   "required": [
      "completed_schemas"
   ]
}

Config:
  • extra: str = ignore

Fields:
field completed_schemas: list[dict] [Required]#
  • SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

  • SPDX-License-Identifier: Apache-2.0

  • Licensed under the Apache License, Version 2.0 (the “License”);

  • you may not use this file except in compliance with the License.

  • You may obtain a copy of the License at

  • https://www.apache.org/licenses/LICENSE-2.0

  • Unless required by applicable law or agreed to in writing, software

  • distributed under the License is distributed on an “AS IS” BASIS,

  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  • See the License for the specific language governing permissions and

  • limitations under the License.

class omni.flux.validator.mass.core.executors.base_executor.BaseExecutor#

Bases: object

abstract submit(
core: _ManagerCore,
print_result: bool = False,
silent: bool = False,
timeout: int | None = None,
standalone: bool | None = False,
queue_id: str | None = None,
) Future#

Submit and execute a job

Parameters:
  • core – the manager core that holds the data

  • print_result – print the resulting schema or not

  • silent – print the stdout or not

  • timeout – timeout for each job

  • standalone – does the process run in a standalone mode or not (like a CLI)

  • queue_id – the queue ID to use. Needed if you have multiple widgets that shows different queues

Returns:

The future of the job (that will hold the result)

  • SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

  • SPDX-License-Identifier: Apache-2.0

  • Licensed under the Apache License, Version 2.0 (the “License”);

  • you may not use this file except in compliance with the License.

  • You may obtain a copy of the License at

  • https://www.apache.org/licenses/LICENSE-2.0

  • Unless required by applicable law or agreed to in writing, software

  • distributed under the License is distributed on an “AS IS” BASIS,

  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  • See the License for the specific language governing permissions and

  • limitations under the License.

class omni.flux.validator.mass.core.executors.current_process_executor.CurrentProcessExecutor(max_concurrent: int = 1)#

Bases: BaseExecutor

submit(
core: _ManagerCore,
print_result: bool = False,
silent: bool = False,
timeout: int | None = None,
standalone: bool | None = False,
queue_id: str | None = None,
) Future#

Submit and execute a job

Parameters:
  • core – the manager core that holds the data

  • print_result – print the resulting schema or not

  • silent – print the stdout or not

  • timeout – timeout for each job

  • standalone – does the process run in a standalone mode or not (like a CLI)

  • queue_id – the queue ID to use. Needed if you have multiple widgets that shows different queues

Returns:

The future of the job (that will hold the result)

  • SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

  • SPDX-License-Identifier: Apache-2.0

  • Licensed under the Apache License, Version 2.0 (the “License”);

  • you may not use this file except in compliance with the License.

  • You may obtain a copy of the License at

  • https://www.apache.org/licenses/LICENSE-2.0

  • Unless required by applicable law or agreed to in writing, software

  • distributed under the License is distributed on an “AS IS” BASIS,

  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  • See the License for the specific language governing permissions and

  • limitations under the License.

class omni.flux.validator.mass.core.executors.external_process_executor.ExternalProcessExecutor#

Bases: BaseExecutor

create_ui()#
submit(
core: _ManagerCore,
print_result: bool = False,
silent: bool = False,
timeout: int | None = None,
standalone: bool | None = False,
queue_id: str | None = None,
)#

Submit and execute a job

Parameters:
  • core – the manager core that holds the data

  • print_result – print the resulting schema or not

  • silent – print the stdout or not

  • timeout – timeout for each job

  • standalone – does the process run in a standalone mode or not (like a CLI)

  • queue_id – the queue ID to use. Needed if you have multiple widgets that shows different queues

Returns:

The future of the job (that will hold the result)

  • SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

  • SPDX-License-Identifier: Apache-2.0

  • Licensed under the Apache License, Version 2.0 (the “License”);

  • you may not use this file except in compliance with the License.

  • You may obtain a copy of the License at

  • https://www.apache.org/licenses/LICENSE-2.0

  • Unless required by applicable law or agreed to in writing, software

  • distributed under the License is distributed on an “AS IS” BASIS,

  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  • See the License for the specific language governing permissions and

  • limitations under the License.

class omni.flux.validator.mass.core.schema_tree.model.Item(data)#

Bases: AbstractItem

Item of the model

async build_ui()#

Build the Mass UI. For each plugin, run the mass_build_ui() function if the plugin exposes it.

can_item_have_children(
item: Item,
) bool#

Define if the item can have children or not

Parameters:

item – the item itself

Returns:

If the item can has a children or not

async cook_template() List[Dict[Any, Any]]#
async cook_template_no_exception() List[Dict[Any, Any]]#

Cook template: meaning that from some input template(s), we can generate others templates. The idea of “cooking” is that a plugin can “edit” template(s) and give back edited template(s).

The algo is: if a plugin return a list of templates during the cooking, the input template will be replaced by this list like: [template01] -> [cooked_template01_01, cooked_template01_02, cooked_template01_03…].

For example, imagine a template where a plugin has a list of files as a data attribute. Cooking can be that the plugin generates 1 new template for each file. From here, the Validator can process each template one by one, and not all files in one process.

Returns:

List of new/cooked template

property model: ManagerCore#

The model

on_mass_cook_template(
success: bool,
message: str | None,
data: Any,
)#
on_mouse_released()#
show(value: bool)#

Called whenever the item is show or hidden in the UI.

subscribe_mass_cook_template(
callback: Callable[[Any], Any],
)#

Return the object that will automatically unsubscribe when destroyed.

subscribe_mouse_released(
function: Callable[[Item], Any],
)#

Subscribe to the on_value_changed_callback event.

Parameters:

function – the callback to execute when the event is triggered

Returns:

An object that will automatically unsubscribe when destroyed.

property title: str#

The title that will be showed on the tree

class omni.flux.validator.mass.core.schema_tree.model.Model#

Bases: AbstractItemModel

Basic list model

add_schemas(
datas: List[Dict[Any, Any]],
)#

Set the items to show

destroy()#
get_item_children(
item: Item | None,
)#

Returns all the children when the widget asks it.

get_item_value_model(item, column_id)#

Return value model. It’s the object that tracks the specific value. In our case we use ui.SimpleStringModel.

get_item_value_model_count(
item: Item,
)#

The number of columns

on_mass_cook_template(
success: bool,
message: str | None,
data: Any,
)#
subscribe_item_mouse_released(
function: Callable[[Item], Any],
)#
subscribe_mass_cook_template(
callback: Callable[[Any], Any],
)#

Return the object that will automatically unsubscribe when destroyed.