---
title: "The Process Facet"
url: https://docs.zeroc.com/ice/3.8/administration/administrative-facility/process-facet
language: python
docs_index: https://docs.zeroc.com/llms.txt
---

> For an index of every page, see [llms.txt](https://docs.zeroc.com/llms.txt).

# The Process Facet

Programming language: Python. Other languages: [C++](https://docs.zeroc.com/ice/3.8/administration/administrative-facility/process-facet/cpp.md), [C#](https://docs.zeroc.com/ice/3.8/administration/administrative-facility/process-facet/csharp.md), [Java](https://docs.zeroc.com/ice/3.8/administration/administrative-facility/process-facet/java.md), [JavaScript](https://docs.zeroc.com/ice/3.8/administration/administrative-facility/process-facet/js.md), [MATLAB](https://docs.zeroc.com/ice/3.8/administration/administrative-facility/process-facet/matlab.md), [PHP](https://docs.zeroc.com/ice/3.8/administration/administrative-facility/process-facet/php.md), [Ruby](https://docs.zeroc.com/ice/3.8/administration/administrative-facility/process-facet/ruby.md), [Swift](https://docs.zeroc.com/ice/3.8/administration/administrative-facility/process-facet/swift.md).

The `Process` facet lets a location service, such as [IceGrid](https://docs.zeroc.com/ice/3.8/services/icegrid.md), request a graceful shutdown of a server. The communicator can register a proxy for this facet with the location service, as described in [Registering the Process Facet with the Location Service](#registering-the-process-facet-with-the-location-service).

> **Note**
>
> Be aware of the [security considerations](https://docs.zeroc.com/ice/3.8/administration/administrative-facility/security-considerations-for-administrative-facets/python.md) associated with enabling the `Process` facet.

## The `Process` Interface

The `Process` facet implements the [`Ice::Process`](https://code.zeroc.com/ice/3.8/api/python/Ice.ProcessPrx.html) interface:

- `shutdown` initiates a graceful shutdown of the program, which can take some time to complete. An IceGrid node that calls `shutdown` [terminates the server](https://docs.zeroc.com/ice/3.8/services/icegrid/icegrid-and-the-administrative-facility.md#deactivating-a-deployed-server) when the shutdown takes too long.
- `writeMessage` prints a message to the program's standard output (`fd` 1) or standard error (`fd` 2).

## Graceful Shutdown

The default `Process` facet calls `shutdown` on the [communicator](https://docs.zeroc.com/ice/3.8/runtime/communicator/python.md). This shuts down the server through a convention that Ice servers follow: the shutdown of the communicator is the signal to exit. The main thread of the server waits for this shutdown, for example by calling `waitForShutdown`, then cleans up and exits.

## Replacing the Process Facet

To shut the program down differently, replace the default `Process` facet with a servant that implements `Ice::Process`. Set [Ice.Admin.DelayCreation](https://docs.zeroc.com/ice/3.8/property-reference/ice-admin-properties/python.md#ice.admin.delaycreation) to `1`, so that the communicator does not create the admin object during initialization:

```config
Ice.Admin.DelayCreation=1
```

Then remove the default facet, add your own, and call `getAdmin` to create the admin object:

```py
# MyProcess implements Ice.Process
myProcessFacet = MyProcess(...)

communicator.removeAdminFacet("Process")
communicator.addAdminFacet(myProcessFacet, "Process")
communicator.getAdmin()
```

## Registering the Process Facet with the Location Service

If [Ice.Admin.ServerId](https://docs.zeroc.com/ice/3.8/property-reference/ice-admin-properties/python.md#ice.admin.serverid) is set and the communicator has a default locator, the communicator registers a proxy for the `Process` facet with the locator registry after creating the admin object, by calling `setServerProcessProxy` with the value of `Ice.Admin.ServerId`.

With [IceGrid](https://docs.zeroc.com/ice/3.8/services/icegrid.md), this value is the ID of the server in its deployment: IceGrid sets `Ice.Admin.ServerId` and `Ice.Default.Locator` for each server that it deploys. When the descriptor of the server defines neither [Ice.Admin.Endpoints](https://docs.zeroc.com/ice/3.8/property-reference/ice-admin-properties/python.md) nor `Ice.Admin.Enabled`, IceGrid also sets `Ice.Admin.Endpoints` to `tcp -h 127.0.0.1`.

## See Also

- [Communicator](https://docs.zeroc.com/ice/3.8/runtime/communicator/python.md)
- [Securing the admin Object](https://docs.zeroc.com/ice/3.8/administration/administrative-facility/security-considerations-for-administrative-facets/python.md)
- [Creating the admin Object](https://docs.zeroc.com/ice/3.8/administration/administrative-facility/creating-the-admin-object/python.md)
- [Using the admin Object](https://docs.zeroc.com/ice/3.8/administration/administrative-facility/using-the-admin-object/python.md)
- [Ice.Admin.\*](https://docs.zeroc.com/ice/3.8/property-reference/ice-admin-properties/python.md)
- [IceGrid](https://docs.zeroc.com/ice/3.8/services/icegrid.md)
