API Reference
- class firexapp.application.ExitSignalHandler(app: FireXBaseApp)[source]
Bases:
object- first_warning = '\nExiting due to signal %s'
- last_warning = "\nFINE! We'll stop. But you might have leaked a celery instance or a broker instance."
- second_warning = '\nWe know! Have a little patience for crying out loud!'
- class firexapp.celery_manager.CeleryManager(logs_dir: str, fx_env: FxEnvVars, plugins: None | str | list[str] = None, app='firexapp.engine.celery:app', env=None)[source]
Bases:
object- property celery_pids_dir
- firexapp.common.create_link(src, target, delete_link=None, relative=False, create_target_dir=False)[source]
- firexapp.common.wait_until(predicate: Callable[[...], T], timeout: float, sleep_for: float, *args, **kwargs) T[source]
- class firexapp.discovery.PkgVersionInfo(pkg=None, version=None, commit=None)[source]
Bases:
PkgVersionInfo
- firexapp.discovery.get_all_pkg_versions() list[PkgVersionInfo][source]
- firexapp.discovery.get_firex_dependant_package_versions() list[PkgVersionInfo][source]
- class firexapp.plugins.CommaDelimitedListAction(option_strings, dest, nargs=None, **kwargs)[source]
Bases:
Action
- firexapp.plugins.merge_plugins(*plugin_lists) list[str][source]
Merge comma delimited lists of plugins into a single list. Right-handed most significant plugin
- firexapp.plugins.plugins_has(plugins: str | list[str], query_basename: str) bool[source]
Check if a plugin basename is present in the plugins string or list.
- Args:
plugins: Either a comma-separated string of plugin paths or a list of plugin paths query_basename: The basename of the plugin to search for (e.g., ‘sparse_build.py’)
- Returns:
True if the query_basename is found in plugins, False otherwise
- class firexapp.engine.default_celery_config.FxCeleryConfig(fx_env: firexapp.engine.default_celery_config.FxEnvVars, timestamp_format: str = '<small>[%(asctime)s]', process_format: str = '[%(levelname)s/%(processName)-13s]', task_format: str = '[%(task_id).8s-%(task_name)s]', message_format: str = ':</small> %(message)s', worker_log_format: str = '<small>[%(asctime)s][%(levelname)s/%(processName)-13s]:</small> %(message)s', worker_task_log_format: str = '<small>[%(asctime)s][%(levelname)s/%(processName)-13s][%(task_id).8s-%(task_name)s]:</small> %(message)s', broker_connection_retry_on_startup: bool = True, worker_prefetch_multiplier: int = 1, worker_redirect_stdouts_level: str = 'PRINT', task_soft_time_limit: int = 4320, link_for_logo: str | None = None, logs_url: str | None = None, resources_dir: str | None = None)[source]
Bases:
object- accept_content = ['pickle', 'json']
- property broker: str
- broker_connection_retry_on_startup: bool = True
- property broker_url: str
- property imports: tuple[str, ...]
- link_for_logo: str | None = None
- property logs_dir: str
- logs_url: str | None = None
- property mc: str
- message_format: str = ':</small> %(message)s'
- primary_worker_minimum_concurrency: ClassVar[int] = 4
- primary_worker_name = 'mc'
- process_format: str = '[%(levelname)s/%(processName)-13s]'
- property redis_bin_dir: str
- resources_dir: str | None = None
- property result_backend: str
- result_expires = None
- result_serializer = 'pickle'
- root_task = 'firexapp.tasks.root_tasks.RootTask'
- task_acks_late = True
- task_default_queue = 'mc'
- task_format: str = '[%(task_id).8s-%(task_name)s]'
- task_serializer = 'pickle'
- task_soft_time_limit: int = 4320
- task_track_started = True
- timestamp_format: str = '<small>[%(asctime)s]'
- property uid: str
- worker_autoscaler
alias of
FireXAutoscaler
- worker_log_format: str = '<small>[%(asctime)s][%(levelname)s/%(processName)-13s]:</small> %(message)s'
- worker_prefetch_multiplier: int = 1
- worker_redirect_stdouts_level: str = 'PRINT'
- worker_task_log_format: str = '<small>[%(asctime)s][%(levelname)s/%(processName)-13s][%(task_id).8s-%(task_name)s]:</small> %(message)s'
- class firexapp.engine.default_celery_config.FxEnvVars(*, CURRENT_RUN_FIREX_ID: str, firex_logs_dir: str, redis_bin_dir: str, BROKER: str, firex_plugins: Annotated[str, BeforeValidator(func=_plugins_to_csv, json_schema_input_type=PydanticUndefined)] = '')[source]
Bases:
BaseModel- BROKER: str
- CURRENT_RUN_FIREX_ID: str
- property broker_url: str
- property firex_id: str
- firex_logs_dir: str
- firex_plugins: Annotated[str, BeforeValidator(func=_plugins_to_csv, json_schema_input_type=PydanticUndefined)]
- property logs_dir: str
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- redis_bin_dir: str
- class firexapp.submit.arguments.InputConverter[source]
Bases:
objectThis class uses a singleton object design to store converters which parse the cli arguments. Converter functions are stored into the singleton InputConverter object by adding the @register decorator to the top of each desired function.
- classmethod convert(pre_load=None, **kwargs) dict[source]
Activates conversion. kwargs provided are passed to any registered converter. This function should be called twice, and only twice. Once with initially loaded converters, and then with the secondary ones.
- Parameters:
pre_load – Used for testing. preload is defaulted to None and will auto populate
- classmethod instance() ConverterRegister[source]
Used for unit testing only
- pre_load_was_run = False
- classmethod register(*args)[source]
Registers a callable object to be run during conversion. The callable should take in kwargs, and return a dict with any changes to the input arguments, or None if no changes are necessary.
- Example single argument converter:
@InputConverter.register @SingleArgDecorator(‘something’) def convert_something(arg_value):
arg_value = arg_value.upper() return arg_value
- Optionally, dependencies can defined at registration:
@InputConverter.register(‘other_converter’, ‘and_another_converter’) @SingleArgDecorator(‘something’) def convert_something(arg_value):
arg_value = arg_value.upper() return arg_value
Conversion occurs on two occasions, before microservices are loaded, or after. You can explicitly mark a converter to run pre-loading or post-loading of the ALL microservices by passing True (pre) or False (post) during registration. This design is used in the spirit of failing fast, providing early failure of runs before the bulk of microservices are imported. If bool is not provided, it will register to run pre unless loading has already occurred.
@InputConverter.register(‘other_converter’, False) @SingleArgDecorator(‘something’) def convert_something(arg_value):
… return arg_value
When a conversion fails the given function can simply call raise to instruct the user how to correct their inputs.
- firexapp.submit.arguments.convert_booleans(kwargs)[source]
Converts standard true/false/none values to bools and None
- firexapp.submit.arguments.find_unused_arguments(chain_args: dict[str, Any], ignore_list: list[str], all_tasks: dict[str, Any])[source]
Function to detect any arguments that are not explicitly consumed by any microservice.
- Note:
This should be run AFTER all microservices have been loaded.
- Parameters:
chain_args (dict) – The dictionary of chain args to check
ignore_list (list) – A list of exception arguments that are acceptable. This usually includes application args.
all_tasks – A list of all microservices. Usually app.tasks
- Returns:
A dictionary of un-applicable arguments
- firexapp.submit.arguments.get_chain_args(other_args: [])[source]
This function converts a flat list of –key value pairs into a dictionary
- firexapp.submit.arguments.whitelist_arguments(argument_list: str | list)[source]
Function for adding argument keys to the global argument whitelist. Used during validation of input arguments
:param argument_list:List of argument keys to whitelist. :type argument_list: list
- class firexapp.submit.console.FireXColoredConsoleFormatter(*args, **kwargs)[source]
Bases:
TTYColoredFormatter
- firexapp.submit.console.setup_console_logging(module=None, stdout_logging_level=20, console_logging_formatter=None, console_datefmt='%H:%M:%S', stderr_logging_level=40, module_logger_logging_level=None)[source]
- class firexapp.submit.reporting.ReportGenerator[source]
Bases:
ABC- formatters = ()
- loaders = ()
- abstract post_run_report(root_async_result: FxAsyncResult, **kwargs)[source]
This could runs in the context of __main__ if –sync, other in the context of celery. So the instance cannot be assumed be the same as in pre_run_report()
- class firexapp.submit.reporting.ReportersRegistry[source]
Bases:
object- classmethod get_generators() list[ReportGenerator][source]
- classmethod post_run_report(root_async_result: FxAsyncResult, chain_args: dict[str, Any])[source]
- firexapp.submit.reporting.report(key_name=None, priority=-1, **formatters)[source]
Use this decorator to indicate what returns to include in the report and how to format it
- firexapp.submit.reporting.report_data(key_name=None, **loaders)[source]
Use this decorator to indicate what returns to include in the report and how to load it
- class firexapp.submit.submit.AdjustCeleryConcurrency(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]
Bases:
Action
- exception firexapp.submit.submit.FireXReturnCodeException(error_msg, firex_returncode)[source]
Bases:
Exception
- class firexapp.submit.submit.JsonFileAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]
Bases:
Action
- class firexapp.submit.submit.OptionalBoolean(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]
Bases:
Action
- class firexapp.submit.submit.SubmitBaseApp(submission_tmp_file: str | None = None)[source]
Bases:
object- DEFAULT_MICROSERVICE = None
- SUBMISSION_LOGGING_FORMATTER = '[%(asctime)s %(levelname)s] %(message)s'
- check_for_failures(root_task_result_promise: FxAsyncResult, unsuccessful_services: dict[str, list[FxAsyncResult]])[source]
- static error_banner(err_msg, banner_title='ERROR', logf=<bound method Logger.error of <Logger firexapp.submit.submit (WARNING)>>)[source]
- main_error_exit_handler(chain_details: tuple[FxAsyncResult, dict[str, Any]] | None = None, reason=None, run_revoked=False)[source]
- process_sync(root_task_result_promise: FxAsyncResult, chain_args: dict[str, Any])[source]
- resolve_install_configs_args(args_from_first_pass: ~argparse.Namespace, other_args_from_first_pass: list) -> (<class 'argparse.Namespace'>, <class 'list'>)[source]
- self_destruct(chain_details: tuple[FxAsyncResult, dict[str, Any]] | None = None, reason: str | None = None, run_revoked: bool = False)[source]
- start_engine(fx_app_cls: type[T], args: Namespace, chain_args: dict[str, Any], uid: Uid) tuple[T, dict[str, Any]][source]
- firexapp.submit.submit.get_unsuccessful_items(ars: list[FxAsyncResult], filters=None) list[str][source]
- class firexapp.submit.tracking_service.TrackingService[source]
Bases:
ABC- get_pkg_version_info() PkgVersionInfo | None[source]
- install_configs: FireXInstallConfigs
- firexapp.submit.tracking_service.get_service_name(service: TrackingService) str[source]
- firexapp.submit.tracking_service.get_tracking_services() tuple[TrackingService, ...][source]
- firexapp.submit.tracking_service.get_tracking_services_versions() list[PkgVersionInfo][source]
- class firexapp.submit.uid.FireXIdParts(user: str, timestamp: datetime.datetime, random_int: int)[source]
Bases:
object- static from_str(firex_id: str) FireXIdParts[source]
- random_int: int
- timestamp: datetime
- user: str
- class firexapp.submit.uid.Uid(identifier=None, firex_requester=None)[source]
Bases:
object- property base_logging_dir
- property debug_dir
- debug_dirname = 'firex_internal'
- property logs_dir: str
- property logs_url
- property resources_dir
- property viewers
- firexapp.submit.uid.get_firex_id_parts(maybe_firex_id: str) FireXIdParts | None[source]
- class firexapp.testing.config_base.FlowTestConfiguration[source]
Bases:
object- property completed_run: FireXRunData
- property name
- run_data: FireXRunData | None
- firexapp.testing.config_base.import_test_configs(path) list[FlowTestConfiguration][source]
- class firexapp.testing.config_interpreter.ConfigInterpreter[source]
Bases:
object- create_cmd(flow_test_config: FlowTestConfiguration) list[str][source]
- execution_directory = None
- static is_submit_command(test_config: FlowTestConfiguration)[source]
- run_executable(cmd, flow_test_config: FlowTestConfiguration)[source]