Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

26c5a2a4-cbdf-41ef-a06d-ded65a96cea1 931 B
Raw

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
  1. from __future__ import annotations
  2. import os
  3. try:
  4. import setproctitle as setproctitle_mod
  5. except ImportError:
  6. setproctitle_mod = None
  7. _enabled = False
  8. def enable_proctitle_on_children():
  9. """
  10. Enable setting the process title on this process' children and
  11. grandchildren.
  12. """
  13. os.environ["DASK_PARENT"] = str(os.getpid())
  14. def enable_proctitle_on_current():
  15. """
  16. Enable setting the process title on this process.
  17. """
  18. global _enabled
  19. _enabled = True
  20. def setproctitle(title):
  21. """
  22. Change this process' title, as displayed in various utilities
  23. such as `ps`.
  24. """
  25. if setproctitle_mod is None:
  26. return
  27. enabled = _enabled
  28. if not enabled:
  29. try:
  30. enabled = int(os.environ.get("DASK_PARENT", "")) != os.getpid()
  31. except ValueError: # pragma: no cover
  32. pass
  33. if enabled:
  34. setproctitle_mod.setproctitle(title)
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...