Tasks and Services#
Records fall into two different categories - task-based and service-based. Task-based records are small, self-contained records that get computed all at once by manager and returned to the server. After this computation, the record is complete. An example of this is a singlepoint record - a compute manager receives the task, runs the singlepoint computation, and returns the result.
A service is a more complex workflow. A portion of the service runs as part of the qcfractal server (as an internal job). This server-side portion is used to generate other records (either service-based or task-based), and then will wait for those dependencies to complete before iterating again (and possibly creating more records). An example of this is an nudged elastic band calculation, where each iteration of the NEB calculation spawns gradient calculations, which are then analyzed to determine the next iteration.
Records have an is_service
property that shows whether or not
this record is service-based.
Tasks#
Records that are task-based are executed as a unit on a compute manager.
These records have a task
property, which contains all the information
necessary for computation. This data is what is actually sent to the compute manager. Typically, a user does not
need to access this object, but it can be useful for developers and for debugging purposes.
This RecordTask
also contains the routing tag and priority.
After successful completion, the associated task is removed from the database.
Services#
Services are more complex than tasks, and have an iterative portion that runs on the QCFractal server. The server is responsible for selecting which services are due for iterating, and code on the server does the iteration itself. There is typically a limit on the number of running services on a server (which is configurable).
Like tasks, services are assigned a tag and priority - the priority determines the order that the services start on the server. Dependencies (new records) created by the services inherit both the tag and priority.
Records that are based on services have a service
property
(a RecordService
), which contains
all the information about the service. Like tasks, it is not commonly needed by users, except for debugging.
Unlike task-based records, service-based records often update their output on the server while running, which can
be viewed with the stdout
property.
Tasks and Services API#
- pydantic model RecordTask[source]#
Bases:
BaseModel
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- Config:
extra: Extra = Extra.forbid
- Fields:
- field id: int [Required]#
- field record_id: int [Required]#
- field function: str | None = None#
- field function_kwargs_compressed: bytes | None = None#
- field tag: str [Required]#
- field priority: PriorityEnum [Required]#
- field required_programs: List[str] [Required]#
- property function_kwargs: Dict[str, Any] | None#
- pydantic model RecordService[source]#
Bases:
BaseModel
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- Config:
extra: Extra = Extra.forbid
- Fields:
- field id: int [Required]#
- field record_id: int [Required]#
- field tag: str [Required]#
- field priority: PriorityEnum [Required]#
- field find_existing: bool [Required]#
- field service_state: Dict[str, Any] | None = None#
- field dependencies: List[ServiceDependency] [Required]#