dragon.globalservices.group
Global Services API for the Group of resources (processes, channels, pools, etc.) primary resource component. Only process groups are supported at this time.
Functions
|
Add existing resources to an existing group. |
|
Asks Global Services to create a new group of specified resources. |
|
Create resources and then add them to an existing group. |
|
Asks Global Services to destroy a specified group of resources. |
|
Remove resources from an existing group and call destroy on them. |
|
Asks Global Services for a list of the g_uids of all groups. |
|
Asks Global Services to send the processes belonging to a specified group a specified signal. |
|
Asks Global Services for the GroupDescriptor of a specified group of resources. |
|
Remove resources from an existing group. |
Exceptions
- exception GroupError
- create(items, policy, user_name='', soft=False)
Asks Global Services to create a new group of specified resources.
- Parameters
items (list[tuple[int, dragon.infrastructure.messages.Message]]) – list of tuples where each tuple contains a replication factor
n
and the Dragon create message. Dragon create messages do not have to be of the same primary resources, i.e. ChannelCreate and ProcessCreate messages can be mixed to into groups to represent composite resources.policy (dragon.infrastructure.policy.Policy) – determines the placement of the group resources
user_name (str, optional) – Requested user specified reference name, defaults to ‘’
soft (bool, optional) – If group already exists with given name, do not create and return descriptor instead, defaults to False
- Raises
GroupError – if soft is True and not given a group name
GroupError – if the action fails
- Returns
the descriptor of the group object
- Return type
- kill(identifier, sig=Signals.SIGKILL)
Asks Global Services to send the processes belonging to a specified group a specified signal.
Note that this is like the unix ‘kill’ command - the signal given to the process might not necessarily be intended to cause it to terminate. If the group contains members other than processes, such as channels, then this operation has no effect to these members.
- Parameters
- Raises
GroupError – if there is no such group
GroupError – if the group has not yet started
NotImplementedError – if any other case not implemented
- Returns
GSGroupKillResponse.desc
- destroy(identifier)
Asks Global Services to destroy a specified group of resources. It will destroy all the members of the group as well as the group itself.
- Parameters
identifier (str|int) – string indicating group name or integer indicating a g_uid
- Raises
GroupError – if there is no such group
GroupError – if the group has not yet started
NotImplementedError – if any other case not implemented
- Returns
the group descriptor in case of a success
- Return type
- add_to(identifier, items)
Add existing resources to an existing group.
- Parameters
- Raises
GroupError – if the addition of resources failed
GroupError – if the identifier corresponds to an unknown group
- create_add_to(identifier, items, policy)
Create resources and then add them to an existing group.
- Parameters
identifier (str|int) – string indicating group name or integer indicating a g_uid
items (list[tuple[int, dragon.infrastructure.messages.Message]]) – list of tuples where each tuple contains a replication factor
n
and the Dragon create message. Dragon create messages do not have to be of the same primary resources, i.e. ChannelCreate and ProcessCreate messages can be mixed to into groups to represent composite resources.policy (dragon.infrastructure.policy.Policy) – determines the placement of the group resources
- Raises
GroupError – if the addition of resources failed
GroupError – if the identifier corresponds to an unknown group
- remove_from(identifier, items)
Remove resources from an existing group.
- Parameters
- Raises
GroupError – if the addition of resources failed
GroupError – if the identifier corresponds to an unknown group
- destroy_remove_from(identifier, items)
Remove resources from an existing group and call destroy on them. For processes we call process.kill (sends a SIGKILL signal) and for other types of resources we call destroy.
- Parameters
- Raises
GroupError – if the addition of resources failed
GroupError – if the identifier corresponds to an unknown group
- get_list()
Asks Global Services for a list of the g_uids of all groups.
- Returns
list of the g_uids of all groups, alive and dead
- Return type
list[g_uids]
- query(identifier)
Asks Global Services for the GroupDescriptor of a specified group of resources. The group can be alive or dead.
- Parameters
identifier (str|int) – string indicating group name or integer indicating a g_uid
- Raises
GroupError – if there is no such group
- Returns
GroupDescriptor object corresponding to specified group
- Return type