diff --git a/app/packages/operators/src/SplitButton.tsx b/app/packages/operators/src/SplitButton.tsx index 73195636609..fbb4b1266db 100644 --- a/app/packages/operators/src/SplitButton.tsx +++ b/app/packages/operators/src/SplitButton.tsx @@ -11,6 +11,7 @@ import { ListItemText, Tooltip, ButtonProps, + Box, } from "@mui/material"; import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown"; import { onEnter } from "./utils"; @@ -128,6 +129,9 @@ export default function SplitButton({ key={option.id} disabled={option.disabled} selected={option.selected} + sx={{ + cursor: option.onClick ? "pointer" : "default", + }} onClick={() => handleSelect(option)} > } - secondary={option.description} + secondary={ + + {option.description} + + } /> ))} @@ -158,13 +172,13 @@ export default function SplitButton({ ); } -function PrimaryWithTag({ label, tag }) { +function PrimaryWithTag({ label, tag, disabled }) { const theme = useTheme(); const tagEl = tag ? ( diff --git a/app/packages/operators/src/state.ts b/app/packages/operators/src/state.ts index 59ccc6c7411..6d4a87e92c0 100644 --- a/app/packages/operators/src/state.ts +++ b/app/packages/operators/src/state.ts @@ -1,7 +1,13 @@ import { useAnalyticsInfo } from "@fiftyone/analytics"; import * as fos from "@fiftyone/state"; import { debounce } from "lodash"; -import { useCallback, useEffect, useMemo, useRef, useState } from "react"; +import React, { + useCallback, + useEffect, + useMemo, + useRef, + useState, +} from "react"; import { atom, selector, @@ -32,6 +38,7 @@ import { import { OperatorPromptType, Places } from "./types"; import { OperatorExecutorOptions } from "./types-internal"; import { ValidationContext } from "./validation"; +import { Markdown } from "@fiftyone/components"; export const promptingOperatorState = atom({ key: "promptingOperator", @@ -231,8 +238,8 @@ function useExecutionOptions(operatorURI, ctx, isRemote) { export type OperatorExecutionOption = { label: string; id: string; - description: string; - onClick: () => void; + description: string | React.ReactNode; + onClick?: () => void; isDelegated: boolean; choiceLabel?: string; tag?: string; @@ -251,7 +258,7 @@ const useOperatorPromptSubmitOptions = ( const persistUnderKey = `operator-prompt-${operatorURI}`; const availableOrchestrators = execDetails.executionOptions?.availableOrchestrators || []; - const hasAvailableOrchestators = availableOrchestrators.length > 0; + const hasAvailableOrchestrators = availableOrchestrators.length > 0; const executionOptions = execDetails.executionOptions || {}; const defaultToExecute = executionOptions.allowDelegatedExecution ? !executionOptions.defaultChoiceToDelegated @@ -287,7 +294,7 @@ const useOperatorPromptSubmitOptions = ( label: "Schedule", id: "schedule", default: defaultToSchedule, - description: "Run this operation on your compute cluster", + description: "Run this operation in the background", onSelect() { setSelectedID("schedule"); }, @@ -300,7 +307,7 @@ const useOperatorPromptSubmitOptions = ( if ( executionOptions.allowDelegatedExecution && - hasAvailableOrchestators && + hasAvailableOrchestrators && executionOptions.orchestratorRegistrationEnabled ) { for (let orc of execDetails.executionOptions.availableOrchestrators) { @@ -321,6 +328,25 @@ const useOperatorPromptSubmitOptions = ( isDelegated: true, }); } + } else if ( + executionOptions.allowDelegatedExecution && + executionOptions.allowImmediateExecution && + executionOptions.orchestratorRegistrationEnabled && + !hasAvailableOrchestrators + ) { + const markdownDesc = React.createElement( + Markdown, + null, + "[Learn how](https://docs.voxel51.com/plugins/using_plugins.html#delegated-operations) to run this operation in the background" + ); + options.push({ + label: "Schedule", + choiceLabel: `Schedule`, + tag: "NOT AVAILABLE", + id: "disabled-schedule", + description: markdownDesc, + isDelegated: true, + }); } // sort options so that the default is always the first in the list @@ -366,10 +392,11 @@ const useOperatorPromptSubmitOptions = ( if (selectedOption) selectedOption.selected = true; const showWarning = executionOptions.orchestratorRegistrationEnabled && - !hasAvailableOrchestators && + !hasAvailableOrchestrators && !executionOptions.allowImmediateExecution; - const warningMessage = - "There are no available orchestrators to schedule this operation. Please contact your administrator to add an orchestrator."; + const warningStr = + "This operation requires [delegated execution](https://docs.voxel51.com/plugins/using_plugins.html#delegated-operations)"; + const warningMessage = React.createElement(Markdown, null, warningStr); return { showWarning, diff --git a/docs/source/images/plugins/operators/operator-user-delegation.png b/docs/source/images/plugins/operators/operator-user-delegation.png deleted file mode 100644 index 82a7f82c6cf..00000000000 Binary files a/docs/source/images/plugins/operators/operator-user-delegation.png and /dev/null differ diff --git a/docs/source/plugins/developing_plugins.rst b/docs/source/plugins/developing_plugins.rst index 9b079173b40..9be6827c5cd 100644 --- a/docs/source/plugins/developing_plugins.rst +++ b/docs/source/plugins/developing_plugins.rst @@ -992,9 +992,8 @@ contains the following properties: instance that you can use to read and write the :ref:`state ` and :ref:`data ` of the current panel, if the operator was invoked from a panel -- `ctx.delegated` - whether delegated execution has been forced for the - operation -- `ctx.requesting_delegated_execution` - whether delegated execution has been +- `ctx.delegated` - whether the operation was delegated +- `ctx.requesting_delegated_execution` - whether delegated execution was requested for the operation - `ctx.delegation_target` - the orchestrator to which the operation should be delegated, if applicable @@ -1248,46 +1247,6 @@ of the current view: to specify the available execution options as described in the previous section. -Alternatively, you could simply ask the user to decide: - -.. code-block:: python - :linenos: - - def resolve_input(self, ctx): - delegate = ctx.params.get("delegate", None) - - if delegate: - description = "Uncheck this box to execute the operation immediately" - else: - description = "Check this box to delegate execution of this task" - - inputs.bool( - "delegate", - label="Delegate execution?", - description=description, - view=types.CheckboxView(), - ) - - if delegate: - inputs.view( - "notice", - types.Notice( - label=( - "You've chosen delegated execution. Note that you must " - "have a delegated operation service running in order for " - "this task to be processed. See " - "https://docs.voxel51.com/plugins/index.html#operators " - "for more information" - ) - ), - ) - - def resolve_delegation(self, ctx): - return ctx.params.get("delegate", None) - -.. image:: /images/plugins/operators/operator-user-delegation.png - :align: center - .. _operator-reporting-progress: Reporting progress diff --git a/docs/source/plugins/using_plugins.rst b/docs/source/plugins/using_plugins.rst index eed8934be62..0a03ef9ebc5 100644 --- a/docs/source/plugins/using_plugins.rst +++ b/docs/source/plugins/using_plugins.rst @@ -891,6 +891,14 @@ FiftyOne Open Source users can run delegated operations via the This command starts a service that will continuously check for any queued delegated operations and execute them serially in its process. +You must also ensure that the +:ref:`allow_legacy_orchestrators ` config flag is set +in the environment where you run the App, e.g. by setting: + +.. code-block:: shell + + export FIFTYONE_ALLOW_LEGACY_ORCHESTRATORS=true + .. _delegated-orchestrator-teamas: FiftyOne Teams diff --git a/docs/source/user_guide/config.rst b/docs/source/user_guide/config.rst index 74043e68eb2..73273a5fa0b 100644 --- a/docs/source/user_guide/config.rst +++ b/docs/source/user_guide/config.rst @@ -14,119 +14,121 @@ Configuration options FiftyOne supports the configuration options described below: -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| Config field | Environment variable | Default value | Description | -+===============================+=====================================+===============================+========================================================================================+ -| `database_admin` | `FIFTYONE_DATABASE_ADMIN` | `True` | Whether the client is allowed to trigger database migrations. See | -| | | | :ref:`this section ` for more information. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `database_dir` | `FIFTYONE_DATABASE_DIR` | `~/.fiftyone/var/lib/mongo` | The directory in which to store FiftyOne's backing database. Only applicable if | -| | | | `database_uri` is not defined. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `database_name` | `FIFTYONE_DATABASE_NAME` | `fiftyone` | A name to use for FiftyOne's backing database in your MongoDB instance. The database | -| | | | is automatically created if necessary. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `database_uri` | `FIFTYONE_DATABASE_URI` | `None` | A `MongoDB URI `_ to | -| | | | specifying a custom MongoDB database to which to connect. See | -| | | | :ref:`this section ` for more information. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `database_validation` | `FIFTYONE_DATABASE_VALIDATION` | `True` | Whether to validate the compatibility of database before connecting to it. See | -| | | | :ref:`this section ` for more information. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `dataset_zoo_dir` | `FIFTYONE_DATASET_ZOO_DIR` | `~/fiftyone` | The default directory in which to store datasets that are downloaded from the | -| | | | :ref:`FiftyOne Dataset Zoo `. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `dataset_zoo_manifest_paths` | `FIFTYONE_ZOO_MANIFEST_PATHS` | `None` | A list of manifest JSON files specifying additional zoo datasets. See | -| | | | :ref:`adding datasets to the zoo ` for more information. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `default_dataset_dir` | `FIFTYONE_DEFAULT_DATASET_DIR` | `~/fiftyone` | The default directory to use when performing FiftyOne operations that | -| | | | require writing dataset contents to disk, such as ingesting datasets via | -| | | | :meth:`ingest_labeled_images() `. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `default_ml_backend` | `FIFTYONE_DEFAULT_ML_BACKEND` | `torch` | The default ML backend to use when performing operations such as | -| | | | downloading datasets from the FiftyOne Dataset Zoo that support multiple ML | -| | | | backends. Supported values are `torch` and `tensorflow`. By default, | -| | | | `torch` is used if `PyTorch `_ is installed in your | -| | | | Python environment, and `tensorflow` is used if | -| | | | `TensorFlow `_ is installed. If no supported backend | -| | | | is detected, this defaults to `None`, and any operation that requires an | -| | | | installed ML backend will raise an informative error message if invoked in | -| | | | this state. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `default_batch_size` | `FIFTYONE_DEFAULT_BATCH_SIZE` | `None` | A default batch size to use when :ref:`applying models to datasets `. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `default_batcher` | `FIFTYONE_DEFAULT_BATCHER` | `latency` | Batching implementation to use in some batched database operations such as | -| | | | :meth:`add_samples() `, | -| | | | :meth:`set_values() `, and | -| | | | :meth:`save_context() `. | -| | | | Supported values are `latency`, `size`, and `static`. | -| | | | | -| | | | `latency` is the default, which uses a dynamic batch size to achieve a target latency | -| | | | of `batcher_target_latency` between calls. The default changes to `size` for the | -| | | | FiftyOne Teams SDK in :ref:`API connection mode `, which targets | -| | | | a size of `batcher_target_size_bytes` for each call. `static` uses a fixed batch size | -| | | | of `batcher_static_size`. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `batcher_static_size` | `FIFTYONE_BATCHER_STATIC_SIZE` | `100` | Fixed size of batches. Only used when `default_batcher` is `static`. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `batcher_target_size_bytes` | `FIFTYONE_BATCHER_TARGET_SIZE_BYTES`| `2 ** 20` | Target content size of batches, in bytes. Only used when `default_batcher` is `size`. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `batcher_target_latency` | `FIFTYONE_BATCHER_TARGET_LATENCY` | `0.2` | Target latency between batches, in seconds. Only used when `default_batcher` is | -| | | | `latency`. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `default_sequence_idx` | `FIFTYONE_DEFAULT_SEQUENCE_IDX` | `%06d` | The default numeric string pattern to use when writing sequential lists of | -| | | | files. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `default_image_ext` | `FIFTYONE_DEFAULT_IMAGE_EXT` | `.jpg` | The default image format to use when writing images to disk. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `default_video_ext` | `FIFTYONE_DEFAULT_VIDEO_EXT` | `.mp4` | The default video format to use when writing videos to disk. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `default_app_port` | `FIFTYONE_DEFAULT_APP_PORT` | `5151` | The default port to use to serve the :ref:`FiftyOne App `. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `default_app_address` | `FIFTYONE_DEFAULT_APP_ADDRESS` | `localhost` | The default address to use to serve the :ref:`FiftyOne App `. This may | -| | | | be either an IP address or hostname. If it's a hostname, the App will listen to all | -| | | | IP addresses associated with the name. The default is `localhost`, which means the App | -| | | | will only listen on the local interface. See :ref:`this page `| -| | | | for more information. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `do_not_track` | `FIFTYONE_DO_NOT_TRACK` | `False` | Controls whether UUID based import and App usage events are tracked. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `logging_level` | `FIFTYONE_LOGGING_LEVEL` | `INFO` | Controls FiftyOne's package-wide logging level. Can be any valid ``logging`` level as | -| | | | a string: ``DEBUG, INFO, WARNING, ERROR, CRITICAL``. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `max_thread_pool_workers` | `FIFTYONE_MAX_THREAD_POOL_WORKERS` | `None` | An optional maximum number of workers to use when creating thread pools | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `max_process_pool_workers` | `FIFTYONE_MAX_PROCESS_POOL_WORKERS` | `None` | An optional maximum number of workers to use when creating process pools | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `model_zoo_dir` | `FIFTYONE_MODEL_ZOO_DIR` | `~/fiftyone/__models__` | The default directory in which to store models that are downloaded from the | -| | | | :ref:`FiftyOne Model Zoo `. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `model_zoo_manifest_paths` | `FIFTYONE_MODEL_ZOO_MANIFEST_PATHS` | `None` | A list of manifest JSON files specifying additional zoo models. See | -| | | | :ref:`adding models to the zoo ` for more information. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `module_path` | `FIFTYONE_MODULE_PATH` | `None` | A list of modules that should be automatically imported whenever FiftyOne is imported. | -| | | | See :ref:`this page ` for an example usage. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `operator_timeout` | `FIFTYONE_OPERATOR_TIMEOUT` | `600` | The timeout for execution of an operator. See :ref:`this page ` for | -| | | | more information. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `plugins_dir` | `FIFTYONE_PLUGINS_DIR` | `None` | A directory containing custom App plugins. See :ref:`this page ` for | -| | | | more information. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `plugins_cache_enabled` | `FIFTYONE_PLUGINS_CACHE_ENABLED` | `False` | When set to ``True`` plugins will be cached until their directory's ``mtime`` changes. | -| | | | This is intended to be used in production. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `requirement_error_level` | `FIFTYONE_REQUIREMENT_ERROR_LEVEL` | `0` | A default error level to use when ensuring/installing requirements such as third-party | -| | | | packages. See :ref:`loading zoo models ` for an example usage. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `show_progress_bars` | `FIFTYONE_SHOW_PROGRESS_BARS` | `True` | Controls whether progress bars are printed to the terminal when performing | -| | | | operations such reading/writing large datasets or activating FiftyOne | -| | | | Brain methods on datasets. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ -| `timezone` | `FIFTYONE_TIMEZONE` | `None` | An optional timezone string. If provided, all datetimes read from FiftyOne datasets | -| | | | will be expressed in this timezone. See :ref:`this section ` for | -| | | | more information. | -+-------------------------------+-------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| Config field | Environment variable | Default value | Description | ++===============================+=======================================+===============================+========================================================================================+ +| `database_admin` | `FIFTYONE_DATABASE_ADMIN` | `True` | Whether the client is allowed to trigger database migrations. See | +| | | | :ref:`this section ` for more information. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `database_dir` | `FIFTYONE_DATABASE_DIR` | `~/.fiftyone/var/lib/mongo` | The directory in which to store FiftyOne's backing database. Only applicable if | +| | | | `database_uri` is not defined. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `database_name` | `FIFTYONE_DATABASE_NAME` | `fiftyone` | A name to use for FiftyOne's backing database in your MongoDB instance. The database | +| | | | is automatically created if necessary. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `database_uri` | `FIFTYONE_DATABASE_URI` | `None` | A `MongoDB URI `_ to | +| | | | specifying a custom MongoDB database to which to connect. See | +| | | | :ref:`this section ` for more information. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `database_validation` | `FIFTYONE_DATABASE_VALIDATION` | `True` | Whether to validate the compatibility of database before connecting to it. See | +| | | | :ref:`this section ` for more information. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `dataset_zoo_dir` | `FIFTYONE_DATASET_ZOO_DIR` | `~/fiftyone` | The default directory in which to store datasets that are downloaded from the | +| | | | :ref:`FiftyOne Dataset Zoo `. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `dataset_zoo_manifest_paths` | `FIFTYONE_ZOO_MANIFEST_PATHS` | `None` | A list of manifest JSON files specifying additional zoo datasets. See | +| | | | :ref:`adding datasets to the zoo ` for more information. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `default_dataset_dir` | `FIFTYONE_DEFAULT_DATASET_DIR` | `~/fiftyone` | The default directory to use when performing FiftyOne operations that | +| | | | require writing dataset contents to disk, such as ingesting datasets via | +| | | | :meth:`ingest_labeled_images() `. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `default_ml_backend` | `FIFTYONE_DEFAULT_ML_BACKEND` | `torch` | The default ML backend to use when performing operations such as | +| | | | downloading datasets from the FiftyOne Dataset Zoo that support multiple ML | +| | | | backends. Supported values are `torch` and `tensorflow`. By default, | +| | | | `torch` is used if `PyTorch `_ is installed in your | +| | | | Python environment, and `tensorflow` is used if | +| | | | `TensorFlow `_ is installed. If no supported backend | +| | | | is detected, this defaults to `None`, and any operation that requires an | +| | | | installed ML backend will raise an informative error message if invoked in | +| | | | this state. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `default_batch_size` | `FIFTYONE_DEFAULT_BATCH_SIZE` | `None` | A default batch size to use when :ref:`applying models to datasets `. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `default_batcher` | `FIFTYONE_DEFAULT_BATCHER` | `latency` | Batching implementation to use in some batched database operations such as | +| | | | :meth:`add_samples() `, | +| | | | :meth:`set_values() `, and | +| | | | :meth:`save_context() `. | +| | | | Supported values are `latency`, `size`, and `static`. | +| | | | | +| | | | `latency` is the default, which uses a dynamic batch size to achieve a target latency | +| | | | of `batcher_target_latency` between calls. The default changes to `size` for the | +| | | | FiftyOne Teams SDK in :ref:`API connection mode `, which targets | +| | | | a size of `batcher_target_size_bytes` for each call. `static` uses a fixed batch size | +| | | | of `batcher_static_size`. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `batcher_static_size` | `FIFTYONE_BATCHER_STATIC_SIZE` | `100` | Fixed size of batches. Only used when `default_batcher` is `static`. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `batcher_target_size_bytes` | `FIFTYONE_BATCHER_TARGET_SIZE_BYTES` | `2 ** 20` | Target content size of batches, in bytes. Only used when `default_batcher` is `size`. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `batcher_target_latency` | `FIFTYONE_BATCHER_TARGET_LATENCY` | `0.2` | Target latency between batches, in seconds. Only used when `default_batcher` is | +| | | | `latency`. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `default_sequence_idx` | `FIFTYONE_DEFAULT_SEQUENCE_IDX` | `%06d` | The default numeric string pattern to use when writing sequential lists of | +| | | | files. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `default_image_ext` | `FIFTYONE_DEFAULT_IMAGE_EXT` | `.jpg` | The default image format to use when writing images to disk. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `default_video_ext` | `FIFTYONE_DEFAULT_VIDEO_EXT` | `.mp4` | The default video format to use when writing videos to disk. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `default_app_port` | `FIFTYONE_DEFAULT_APP_PORT` | `5151` | The default port to use to serve the :ref:`FiftyOne App `. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `default_app_address` | `FIFTYONE_DEFAULT_APP_ADDRESS` | `localhost` | The default address to use to serve the :ref:`FiftyOne App `. This may | +| | | | be either an IP address or hostname. If it's a hostname, the App will listen to all | +| | | | IP addresses associated with the name. The default is `localhost`, which means the App | +| | | | will only listen on the local interface. See :ref:`this page `| +| | | | for more information. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `do_not_track` | `FIFTYONE_DO_NOT_TRACK` | `False` | Controls whether UUID based import and App usage events are tracked. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `logging_level` | `FIFTYONE_LOGGING_LEVEL` | `INFO` | Controls FiftyOne's package-wide logging level. Can be any valid ``logging`` level as | +| | | | a string: ``DEBUG, INFO, WARNING, ERROR, CRITICAL``. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `max_thread_pool_workers` | `FIFTYONE_MAX_THREAD_POOL_WORKERS` | `None` | An optional maximum number of workers to use when creating thread pools | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `max_process_pool_workers` | `FIFTYONE_MAX_PROCESS_POOL_WORKERS` | `None` | An optional maximum number of workers to use when creating process pools | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `model_zoo_dir` | `FIFTYONE_MODEL_ZOO_DIR` | `~/fiftyone/__models__` | The default directory in which to store models that are downloaded from the | +| | | | :ref:`FiftyOne Model Zoo `. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `model_zoo_manifest_paths` | `FIFTYONE_MODEL_ZOO_MANIFEST_PATHS` | `None` | A list of manifest JSON files specifying additional zoo models. See | +| | | | :ref:`adding models to the zoo ` for more information. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `module_path` | `FIFTYONE_MODULE_PATH` | `None` | A list of modules that should be automatically imported whenever FiftyOne is imported. | +| | | | See :ref:`this page ` for an example usage. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `operator_timeout` | `FIFTYONE_OPERATOR_TIMEOUT` | `600` | The timeout for execution of an operator. See :ref:`this page ` for | +| | | | more information. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `allow_legacy_orchestrators` | `FIFTYONE_ALLOW_LEGACY_ORCHESTRATORS` | `False` | Whether to allow delegated operations to be scheduled locally. | +| | | | See :ref:`this page ` for more information. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `plugins_dir` | `FIFTYONE_PLUGINS_DIR` | `None` | A directory containing custom App plugins. See :ref:`this page ` for | +| | | | more information. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `plugins_cache_enabled` | `FIFTYONE_PLUGINS_CACHE_ENABLED` | `False` | When set to ``True`` plugins will be cached until their directory's ``mtime`` changes. | +| | | | This is intended to be used in production. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `do_not_track` | `FIFTYONE_DO_NOT_TRACK` | `False` | Controls whether UUID based import and App usage events are tracked. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `show_progress_bars` | `FIFTYONE_SHOW_PROGRESS_BARS` | `True` | Controls whether progress bars are printed to the terminal when performing | +| | | | operations such reading/writing large datasets or activating FiftyOne | +| | | | Brain methods on datasets. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ +| `timezone` | `FIFTYONE_TIMEZONE` | `None` | An optional timezone string. If provided, all datetimes read from FiftyOne datasets | +| | | | will be expressed in this timezone. See :ref:`this section ` for | +| | | | more information. | ++-------------------------------+---------------------------------------+-------------------------------+----------------------------------------------------------------------------------------+ Viewing your config ------------------- @@ -178,6 +180,7 @@ and the CLI: "model_zoo_manifest_paths": null, "module_path": null, "operator_timeout": 600, + "allow_legacy_orchestrators": false, "plugins_cache_enabled": false, "plugins_dir": null, "requirement_error_level": 0, @@ -227,6 +230,7 @@ and the CLI: "model_zoo_manifest_paths": null, "module_path": null, "operator_timeout": 600, + "allow_legacy_orchestrators": false, "plugins_cache_enabled": false, "plugins_dir": null, "requirement_error_level": 0, diff --git a/fiftyone/core/config.py b/fiftyone/core/config.py index 653648a37bb..1e7b04b9744 100644 --- a/fiftyone/core/config.py +++ b/fiftyone/core/config.py @@ -120,6 +120,12 @@ def __init__(self, d=None): env_var="FIFTYONE_OPERATOR_TIMEOUT", default=600, # 600 seconds (10 minutes) ) + self.allow_legacy_orchestrators = self.parse_bool( + d, + "allow_legacy_orchestrators", + env_var="FIFTYONE_ALLOW_LEGACY_ORCHESTRATORS", + default=False, + ) self.dataset_zoo_manifest_paths = self.parse_path_array( d, "dataset_zoo_manifest_paths", diff --git a/fiftyone/operators/executor.py b/fiftyone/operators/executor.py index c15bbcc0699..892dd33c73c 100644 --- a/fiftyone/operators/executor.py +++ b/fiftyone/operators/executor.py @@ -258,6 +258,7 @@ async def execute_or_delegate_operator( try: from .delegated import DelegatedOperationService + ctx.request_params["delegated"] = True metadata = {"inputs_schema": None, "outputs_schema": None} try: @@ -694,12 +695,12 @@ def panel(self): @property def delegated(self): - """Whether delegated execution has been forced for the operation.""" + """Whether the operation was delegated.""" return self.request_params.get("delegated", False) @property def requesting_delegated_execution(self): - """Whether delegated execution has been requested for the operation.""" + """Whether delegated execution was requested for the operation.""" return self.request_params.get("request_delegation", False) @property @@ -1277,7 +1278,7 @@ def available_orchestrators(self): @property def orchestrator_registration_enabled(self): - return False + return not fo.config.allow_legacy_orchestrators def update(self, available_orchestrators=None): self._available_orchestrators = available_orchestrators