libjob


Namelibjob JSON
Version 0.1.3 PyPI version JSON
download
home_pageNone
SummaryPython warpper of the Windows job feature, replacement of the resource library
upload_time2024-11-12 06:16:13
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseNone
keywords job resource win32 windows
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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:
```python
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`
```python
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`
```python
job = libjob.Job()
job.process_memory_limit = 100 * 1024 * 1024
job.assign(pid1)
job.assign(pid2)
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "libjob",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "job, resource, win32, windows",
    "author": null,
    "author_email": "Colinxu2020 <colinxu2020@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/fc/f0/a89ef658f837dee667dda5df6bbd623292776b192c394c5f8016523c33f3/libjob-0.1.3.tar.gz",
    "platform": null,
    "description": "# LibJob\nLibJob is the python wrapper of windows's `job` feature, which could replace `resource` easily.\n\nUsing Example & Compares(when applying 100MB memory limit to given two processes):\nby `resource` standard library:\n```python\ncurlimit = resource.prlimit(pid1, resource.RLIMIT_VMEM)\nresource.prlimit(pid1, resource.RLIMIT_MEMLOCK, (100 * 1024 * 1024, curlimit[1]))\ncurlimit = resource.prlimit(pid2, resource.RLIMIT_VMEM)\nresource.prlimit(pid2, resource.RLIMIT_MEMLOCK, (100 * 1024 * 1024, curlimit[1]))\n```\nby using `pywin32`\n```python\njob = win32job.CreateJobObject(None, \"\")\nextended_info = win32job.QueryInformationJobObject(job, win32job.JobObjectExtendedLimitInformation)\nextended_info[\"ProcessMemoryLimit\"] = 100 * 1024 * 1024\nextended_info[\"BasicLimitInformation\"][\"LimitFlags\"] |= win32job.JOB_OBJECT_LIMIT_PROCESS_MEMORY\nwin32job.SetInformationJobObject(job, win32job.JobObjectExtendedLimitInformation, extended_info)\nproc = win32api.OpenProcess(win32con.PROCESS_SET_QUOTA | win32con.PROCESS_TERMINATE, False, pid1)\nwin32job.AssignProcessToJobObject(job, proc)\nproc = win32api.OpenProcess(win32con.PROCESS_SET_QUOTA | win32con.PROCESS_TERMINATE, False, pid2)\nwin32job.AssignProcessToJobObject(job, proc)\n```\nby using `libjob`\n```python\njob = libjob.Job()\njob.process_memory_limit = 100 * 1024 * 1024\njob.assign(pid1)\njob.assign(pid2)\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python warpper of the Windows job feature, replacement of the resource library",
    "version": "0.1.3",
    "project_urls": {
        "Changelog": "https://github.com/colinxu2020/libjob/ blob/master/CHANGELOG.md",
        "Issues": "https://github.com/colinxu2020/libjob/issues",
        "Repository": "https://github.com/colinxu2020/libjob"
    },
    "split_keywords": [
        "job",
        " resource",
        " win32",
        " windows"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ce35abc28be3721813022712a510f32e5402eaa1d795d2206c9489150bf70331",
                "md5": "446fb3dbfbfdf1848c2385f197293dfb",
                "sha256": "4a1daa4aa20e9d513d502ff48f91ac4e652e76ab6e167155668204ebddf9d1bb"
            },
            "downloads": -1,
            "filename": "libjob-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "446fb3dbfbfdf1848c2385f197293dfb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 19746,
            "upload_time": "2024-11-12T06:16:12",
            "upload_time_iso_8601": "2024-11-12T06:16:12.094359Z",
            "url": "https://files.pythonhosted.org/packages/ce/35/abc28be3721813022712a510f32e5402eaa1d795d2206c9489150bf70331/libjob-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "fcf0a89ef658f837dee667dda5df6bbd623292776b192c394c5f8016523c33f3",
                "md5": "b3141738fa2e4686b03424d9b24242e7",
                "sha256": "1f54c6f5038b6e2bd366dc4018578deb7c3391e88293fde71d55f86fc268fbab"
            },
            "downloads": -1,
            "filename": "libjob-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "b3141738fa2e4686b03424d9b24242e7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 20856,
            "upload_time": "2024-11-12T06:16:13",
            "upload_time_iso_8601": "2024-11-12T06:16:13.515080Z",
            "url": "https://files.pythonhosted.org/packages/fc/f0/a89ef658f837dee667dda5df6bbd623292776b192c394c5f8016523c33f3/libjob-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-12 06:16:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "colinxu2020",
    "github_project": "libjob",
    "github_not_found": true,
    "lcname": "libjob"
}
        
Elapsed time: 0.43096s