enthought / enthought/envisage

Provide better facilities or patterns for service cleanup

Open
#452 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: discussion type: enhancement
Dominant language
Python
Stars
89
Forks
27
Avg merge
14h 48m
Merged PRs (30d)
7

Description

Envisage services often require some form of cleanup. For example, if a plugin offers a service that provides a pool of worker threads, those worker threads should typically be shut down before process exit.

Currently there don't seem to be clean patterns for doing this, and there are some pitfalls with current common approaches. One common pattern has the service object - e.g., the ThreadPoolExecutor for the above example - as a trait on the plugin that offers the service, and then uses the plugin's stop method to shut down the executor. But if using Traits defaults, it's easy to write this in such a way that the executor is accidentally started (and then stopped) during the stop method. That's merely inefficient, but for more complicated things, trying to start a service during application shutdown may not work at all.

There may be ways that Envisage can be improved here. Failing that, we can at least document possible approaches and their pitfalls.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the plugin stop lifecycle and the Traits default behavior described in the issue, then examine how services such as a ThreadPoolExecutor are created and cleaned up. Compare possible cleanup patterns and their shutdown pitfalls. Done means either a clear Envisage facility for safe service cleanup or documentation of recommended approaches and limitations.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.