Creating A Request

From python on client side

rail_pz_service.client.request.PZRailRequestClient.create(obj, **kwargs)
Parameters:
Return type:

response_model_class

class rail_pz_service.models.RequestCreate(*, user=None, estimator_name, dataset_name)[source]

Request Parameters that are used to create new rows but not in DB tables

Parameters:
  • user (str | None)

  • estimator_name (str)

  • dataset_name (str)

estimator_name: str

Name of the estimator

dataset_name: str

Name of the dataset

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

user: str | None

User who orginated this Request

From client CLI

pz-rail-service-client request create

Create a new row

pz-rail-service-client request create [OPTIONS]

Options

-o, --output <output>

Output format. Summary table if not specified.

Options:

yaml | json

--dataset-name <dataset_name>

Name of associated dataset

--estimator-name <estimator_name>

Name of associated estimator

--name <name>

Name for a particular DB row

From python on server side

async rail_pz_service.db.cache.Cache.create_request(self, session, dataset_name, estimator_name)

Run a request

Parameters:
  • session (async_scoped_session) – DB session manager

  • dataset_name (str) – Name of associated Dataset

  • estimator_name (str) – Name of associated Estimator

Returns:

Request in question

Return type:

Request

Example

from structlog import get_logger
logger = get_logger(__name__)
cache  = pz_rail_service.db.Cache.shared_cache(logger)
new_request = await cache.create_request(
    session,
    dataset_name='my_com_cam_dataset',
    estimator_name='my_gpz_com_cam_estimaor',
)

From server CLI

pz-rail-service-admin request create

Create a new row

pz-rail-service-admin request create [OPTIONS]

Options

-o, --output <output>

Output format. Summary table if not specified.

Options:

yaml | json

--dataset-name <dataset_name>

Name of associated dataset

--estimator-name <estimator_name>

Name of associated estimator

--name <name>

Name for a particular DB row