Skip to main content

Python warpper of the Windows job feature, replacement of the resource library

Reason this release was yanked:

Mistakely grammar error

Project description

LibJob

LibJob is the python wrapper of windows's job feature, which could replace resource easily.

Using Example & Compares(when applying 100MB memory limit to given two processes): by resource standard library:

curlimit = resource.prlimit(pid1, resource.RLIMIT_VMEM)
resource.prlimit(pid1, resource.RLIMIT_MEMLOCK, (100 * 1024 * 1024, curlimit[1]))
curlimit = resource.prlimit(pid2, resource.RLIMIT_VMEM)
resource.prlimit(pid2, resource.RLIMIT_MEMLOCK, (100 * 1024 * 1024, curlimit[1]))

by using pywin32

job = win32job.CreateJobObject(None, "")
extended_info = win32job.QueryInformationJobObject(job, win32job.JobObjectExtendedLimitInformation)
extended_info["ProcessMemoryLimit"] = 100 * 1024 * 1024
extended_info["BasicLimitInformation"]["LimitFlags"] |= win32job.JOB_OBJECT_LIMIT_PROCESS_MEMORY
win32job.SetInformationJobObject(job, win32job.JobObjectExtendedLimitInformation, extended_info)
proc = win32api.OpenProcess(win32con.PROCESS_SET_QUOTA | win32con.PROCESS_TERMINATE, False, pid1)
win32job.AssignProcessToJobObject(job, proc)
proc = win32api.OpenProcess(win32con.PROCESS_SET_QUOTA | win32con.PROCESS_TERMINATE, False, pid2)
win32job.AssignProcessToJobObject(job, proc)

by using libjob

job = libjob.Job()
job.process_memory_limit = 100 * 1024 * 1024
job.assign(pid1)
job.assign(pid2)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

libjob-0.1.1.tar.gz (21.0 kB view details)

Uploaded Source

Built Distribution

libjob-0.1.1-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

Details for the file libjob-0.1.1.tar.gz.

File metadata

  • Download URL: libjob-0.1.1.tar.gz
  • Upload date:
  • Size: 21.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.1

File hashes

Hashes for libjob-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1d041ef29b92b956e8936b931e3e62d8c103c10fe3c9c3cb785b3f6d4cb1f046
MD5 f719ae17001433934e9dfce36f8076a1
BLAKE2b-256 57897b907d1d46a57162e46e967892839b0ab93415f50602402d284c7c3be22a

See more details on using hashes here.

File details

Details for the file libjob-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: libjob-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 19.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.1

File hashes

Hashes for libjob-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a88dbc54c547bf1c85958b7bb5d6d81e1c2eea7cbfe61733280ea38fdc3f15a5
MD5 4edd890657bac315ad3f686416dfc4ab
BLAKE2b-256 35f5f3adbbd2f7aef3f033d3a22d077c508356c306a30342eeb8a8280f2732c1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page