Skip to content

CLI Options

General options:

  • -a {fastapi,grpc}, --api {fastapi,grpc}
    Which API to generate (default: fastapi)
  • --add-ssh-key ADD_SSH_KEY
    Add an SSH key (for example for a remote repo).
    Provide the key in an environment variable and specify the environment variable name with this argument.
    Multiple keys can be added if necessary. Keys are added before any other commands are processed. (default: None)
  • --modify-config MODIFY_CONFIG
    Add new SSF config fields, or override existing SSF config fields.
    Values will be set as string literal if the field is new, or must otherwise evaluate to the correct type for an existing field.
    Syntax: "<field>=<value>;<field>=<value>;...;". Use "field[<idx>]=...." for list entries.
    Example: "application.trace=False;endpoints[0].id=my_modified_endpoint"
    (default: None)
  • --file-log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}
    Set file log level. (default: DEBUG)
  • --stdout-log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}
    Set stdout log level. (default: INFO)

Runtime (gc-ssf run) options:

  • --host HOST Address to bind to (serve from) (default: 0.0.0.0)
  • -p PORT, --port PORT Port to bind to (serve from) (default: 8100)
  • -ra REPLICATE_APPLICATION, --replicate-application REPLICATE_APPLICATION
    Number of application instances (default: 1)
  • -k KEY, --key KEY Secure the API with an API key. (default: None)
  • --watchdog-request-threshold WATCHDOG_REQUEST_THRESHOLD
    Set threshold value in seconds for request duration.
    If exceeded the watchdog will restart the application instance.
    Value set to 0 (default) disables the request duration watchdog. (default: 0)
  • --watchdog-request-average WATCHDOG_REQUEST_AVERAGE
    Set number of last requests included in calculating average watchdog request duration. (default: 3)
  • --watchdog-ready-period WATCHDOG_READY_PERIOD
    Set the time period without a request after which the application instance's watchdog callback function
    will be polled to check that the application is still ready to receive the next request when it arrives.
    If the callback function does not return RESULT_OK then the application instance will be restarted.
    Value set to 0 disables the ready watchdog. (default: 5)
  • --batching-timeout BATCHING_TIMEOUT
    Set how many seconds the server will wait to accumulate samples when batching is enabled. (default: 1)
  • --max-allowed-restarts MAX_ALLOWED_RESTARTS
    Number of time a replica can fails successively on restart before going to an irrecoverable error state (default: 2)
  • --stop-on-error By default, an application will continue to be served even if in an irrecoverable error state.
    The health probes (health/live, health/ready) can be used to detect this occurence.
    Set this option if you prefer the application to stop and exit immediately on error. (default: False)
  • --prometheus-disabled
    Disable Prometheus client along with SSF server runtime metrics. (default: False)
  • --prometheus-buckets PROMETHEUS_BUCKETS [PROMETHEUS_BUCKETS ...]
    Prometheus buckets to be used with latency and duration metrics. (default: [0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 7.5, 10, 30, 60])
  • --prometheus-endpoint PROMETHEUS_ENDPOINT
    Address of Prometheus metrics endpoint. (default: /metrics)
  • --prometheus-port PROMETHEUS_PORT
    If prometheus-port is is not specified then the Prometheus metrics will share an HTTP server with the service.
    If prometheus-port is specified then two separate HTTP servers will run - one for Prometheus metrics and one for the service. (default: )

Container options (package and publish):

  • --package-baseimage PACKAGE_BASEIMAGE
    Override default baseimage when packaging.
    The default baseimage is taken from the application config (application.package.docker.baseimage),
    or set to graphcore/pytorch:3.3.0-ubuntu-20.04-20230703. If PACKAGE_BASEIMAGE is specified then it overrides the default baseimage. (default: None)
  • --package-name PACKAGE_NAME
    Override default bundle name when packaging or publishing. (default: None)
  • --package-tag PACKAGE_TAG
    Override default image tag when packaging or publishing.
    Format: --package-tag user/repo:tag (default: None)
  • --docker-username DOCKER_USERNAME
    Username for login, if login to a docker repository is required when publishing.
    You can login to your docker server before running SSF if preferred, in which case this argument can be skipped.
    If login is required, both username and password must be specified, server is optional.
    (default: None)
  • --docker-password DOCKER_PASSWORD
    Password for login, if login to a docker repository is required when publishing.
    You can login to your docker server before running SSF if preferred, in which case this argument can be skipped.
    If login is required, both username and password must be specified, server is optional.
    (default: None)
  • --container-server CONTAINER_SERVER
    Server for login, if login to a container repository is required when publishing.
    You can login to your container server before running SSF if preferred, in which case this argument can be skipped.
    If login is required, both username and password must be specified, server is optional. (default: None)

Deployment (gc-ssf deploy) options:

  • --deploy-platform {Paperspace,Gcore}
    The target platform for deployment.
    Gcore deployments start or update a deployment at the specified remote target address using a simple bash boot script and ssh.
    Paperspace deployments create a deployment spec and use the Gradient API to run or update it. (default: Gcore)
  • --deploy-name DEPLOY_NAME
    The deployment name (defaults to application ID if not specified). (default: None)
  • --deploy-package The default is to deploy an SSF container and dynamically build and run the application from within the SSF container.
    Use this option to instead deploy the application's pre-packaged and published container. (default: False)
  • --deploy-custom-args DEPLOY_CUSTOM_ARGS
    Add additional custom SSF arguments to the deployment SSF CLI invocation.
    The specified argument string will be appended to the default SSF_OPTIONS environment variable that is constructed to pass SSF arguments to the remote target image. (default: None)
  • --deploy-gcore-target-username DEPLOY_GCORE_TARGET_USERNAME
    Gcore: The target username with which to launch the deployment. (default: None)
  • --deploy-gcore-target-address DEPLOY_GCORE_TARGET_ADDRESS
    Gcore: The target address with which to launch the deployment. (default: None)
  • --deploy-paperspace-registry DEPLOY_PAPERSPACE_REGISTRY
    Paperspace: The containerRegistry entry when auto generating the deployment specification for deployment. (default: Graphcore Cloud Solutions Dev R-O)
  • --deploy-paperspace-project-id DEPLOY_PAPERSPACE_PROJECT_ID
    Paperspace: The deployment platform project ID. (default: None)
  • --deploy-paperspace-cluster-id DEPLOY_PAPERSPACE_CLUSTER_ID
    Paperspace: The deployment platform cluster ID. (default: clehbtvty)
  • --deploy-paperspace-api-key DEPLOY_PAPERSPACE_API_KEY
    Paperspace: Name of the environment variable where your token is stored (do not write your token directly here). (default: None)
  • --deploy-paperspace-replicas DEPLOY_PAPERSPACE_REPLICAS
    Paperspace: Number of deployment instances (containers) to start. (default: 1)
  • --deploy-paperspace-spec-file DEPLOY_PAPERSPACE_SPEC_FILE
    Paperspace: The deployment specification will be generated automatically if one is required for the platform.
    It can be overridden with this argument. (default: None)

Test (gc-ssf test) options:

  • --test-skip-stop Don't stop the application container after running 'test'. (default: False)
  • --test-skip-start Don't start the application container before running 'test' (assume it is already running). (default: False)

FastAPI API options:

  • --enable-cors-middleware
    Enable CORS middleware (default: False)
  • --cors-allow-origin-regex CORS_ALLOW_ORIGIN_REGEX
    Allow origin regex when CORS middleware is enabled. (default: http.*://(?:localhost|127.0.0.1)(?::d+)?)
  • --cors-allow-credentials CORS_ALLOW_CREDENTIALS
    Allow credentials when CORS middleware is enabled. (default: True)
  • --cors-allow-methods CORS_ALLOW_METHODS
    Allowed methods when CORS middleware is enabled (comma-separated list). (default: *)
  • --cors-allow-headers CORS_ALLOW_HEADERS
    Allowed headers when CORS middleware is enabled (comma-separated list). (default: *)
  • --cors-expose-headers CORS_EXPOSE_HEADERS
    Exposed headers when CORS middleware is enabled (comma-separated list). (default: )
  • --cors-max-age CORS_MAX_AGE
    Maximum time in seconds for cached CORS reponses when CORS middleware is enabled. (default: 600)
  • --enable-ssl Enable Uvicorn SSL (default: False)
  • --ssl-certificate-file SSL_CERTIFICATE_FILE
    File path to SSL certificate when SSL middleware is enabled. (default: ssl-cert.pem)
  • --ssl-key-file SSL_KEY_FILE
    File path to SSL key when SSL middleware is enabled. (default: ssl-key.pem)
  • --enable-session-authentication
    Enable session authentication using HTTP Basic authentication.
    You must use --session-authentication-module-file to also provide an authorise_user() implementation. (default: False)
  • --session-authentication-module-file SESSION_AUTHENTICATION_MODULE_FILE
    Specify a session authentication module used for authentication of user login.
    This must implement a function authenticate_user(username: str, password: str).
    This should return None if the username and password are not authorised, or
    a 'user id' as string if the username and password are authorised
    The default implementation declares a single test user with username test and password 123456. (default: ssf/default_authentication.py)
  • --session-authentication-timeout SESSION_AUTHENTICATION_TIMEOUT
    Session authentication timeout (default: 10080)
  • -rs FASTAPI_REPLICATE_SERVER, --fastapi-replicate-server FASTAPI_REPLICATE_SERVER
    Number of server instances (default: 1)

gRPC API options:

  • --grpc-max-connections GRPC_MAX_CONNECTIONS
    Maximal number of simultaneous connections to gRPC server. (default: 10)