{"id":19989618,"url":"https://github.com/wavesoft/pycreditpiggy","last_synced_at":"2025-03-01T21:50:12.143Z","repository":{"id":35090862,"uuid":"39250570","full_name":"wavesoft/PyCreditPiggy","owner":"wavesoft","description":"CreditPiggy Daemon interface library for python","archived":false,"fork":false,"pushed_at":"2015-07-17T11:34:33.000Z","size":144,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-01T20:02:12.419Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wavesoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-17T11:19:14.000Z","updated_at":"2015-07-17T11:21:26.000Z","dependencies_parsed_at":"2022-08-18T05:15:28.232Z","dependency_job_id":null,"html_url":"https://github.com/wavesoft/PyCreditPiggy","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavesoft%2FPyCreditPiggy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavesoft%2FPyCreditPiggy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavesoft%2FPyCreditPiggy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavesoft%2FPyCreditPiggy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wavesoft","download_url":"https://codeload.github.com/wavesoft/PyCreditPiggy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241430321,"owners_count":19961635,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T04:48:44.903Z","updated_at":"2025-03-01T21:50:12.123Z","avatar_url":"https://github.com/wavesoft.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# CreditPiggy Daemon Interface\n\nThe `creditpiggy` library provides all the high-level routines for interfacing with the creditpiggy daemon that runs in the job-manager site.\n\nIf your job management mechanism is written in python, you can use this library off the shelf.\n\n## API Reference\n\nThe following functions are exposed by the `creditpiggy` library:\n\n### cpapi_setup(server_endpoint, credentials=None)\n\nInitialises the CreditPiggy api library. This function should be called before any other CreditPiggy API operations in order to define the endpoint where the daemon is running.\n\nHowever, if you never call this function, the library is going to assume that you are using the CreditPiggy daemon default set-up, that listens on the UNIX socket at `/var/run/creditapi.socket`. \n\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003cth\u003eName\u003c/th\u003e\n        \u003cth\u003eType\u003c/th\u003e\n        \u003cth\u003eDesc\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003cth\u003e\u003ccode\u003eserver_endpoint\u003c/code\u003e\u003c/th\u003e\n        \u003cth\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/th\u003e\n        \u003ctd\u003e\n            The daemon endpoint. Depending on the format of the string, three different types of endpoints can be defined:\n            \u003cul\u003e\n                \u003cli\u003e\u003ccode\u003eUNIX Socket\u003c/code\u003e (ex. \"/var/run/creditapi.socket\"): Indicate that the daemon runs locally under the specified UNIX socket.\u003c/li\u003e\n                \u003cli\u003e\u003ccode\u003eNetwork Endpoint\u003c/code\u003e (ex. \"1.2.3.4:5667\"): Indicate that the daemon runs remotely under the specified network endpoint.\u003c/li\u003e\n                \u003cli\u003e\u003ccode\u003eURL\u003c/code\u003e (ex. \"https://cp.org/api\"): Indicate that no intermediate daemon should be used, but the library should directly contact the CreditPiggy server under the specified API URL. When you use this option, \u003ccode\u003ecredentials\u003c/code\u003e should contain a tuple with your \u003ccode\u003e(project_id, project_auth)\u003c/code\u003e. \u003cstrong\u003eNOTE: This option is not implemented yet!\u003c/strong\u003e \u003c/li\u003e\n            \u003c/ul\u003e\n        \u003c/td\u003e\n    \u003c/tr\u003e\n\u003c/table\u003e\n\n### cpapi_alloc(slot_id, min=None, max=None, credits=None)\n\nAllocate a slot with the specified ID and give the specified credits or credit range on it.\n\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003cth\u003eName\u003c/th\u003e\n        \u003cth\u003eType\u003c/th\u003e\n        \u003cth\u003eDesc\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003cth\u003e\u003ccode\u003eslot_id\u003c/code\u003e\u003c/th\u003e\n        \u003cth\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/th\u003e\n        \u003ctd\u003e\n            A unique ID that identifies the slot to allocate. This ID should be unique throughout your project but it doesn't need to be globally unique.\n        \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003cth\u003e\u003ccode\u003emin, max\u003c/code\u003e\u003c/th\u003e\n        \u003cth\u003e\u003ccode\u003einteger\u003c/code\u003e\u003c/th\u003e\n        \u003ctd\u003e\n            The minimum and maximum number of credits this slot is capable of\n            giving. The exact amount is defined during claim, but cannot be out of the specified bounds.\n        \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003cth\u003e\u003ccode\u003ecredits\u003c/code\u003e\u003c/th\u003e\n        \u003cth\u003e\u003ccode\u003einteger\u003c/code\u003e\u003c/th\u003e\n        \u003ctd\u003e\n            The exact number of credits this slot will give to the machine that claims it.\n        \u003c/td\u003e\n    \u003c/tr\u003e\n\u003c/table\u003e\n\n### cpapi_discard(slot_id, reason=None)\n\nDiscard the slot 'slot_id', optionally indicating the reason for doing so. Such reason might be 'expired', 'invalid', 'lost' etc.\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003cth\u003eName\u003c/th\u003e\n        \u003cth\u003eType\u003c/th\u003e\n        \u003cth\u003eDesc\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003cth\u003e\u003ccode\u003eslot_id\u003c/code\u003e\u003c/th\u003e\n        \u003cth\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/th\u003e\n        \u003ctd\u003e\n            A unique ID that identifies the slot to allocate. This ID should be unique throughout your project but it doesn't need to be globally unique.\n        \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003cth\u003e\u003ccode\u003erason\u003c/code\u003e\u003c/th\u003e\n        \u003cth\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/th\u003e\n        \u003ctd\u003e\n            A short identifier that explains the reason why the slot was discarded. Such reasons could be 'expired', 'invalid', 'lost' etc.\n        \u003c/td\u003e\n    \u003c/tr\u003e\n\u003c/table\u003e\n\n### cpapi_claim(slot_id, machine_id, credits=None)\n\nClaim a slot previously allocated with `cpapi_alloc` by the machine with the specified `machine_id`. If credits were not allocated at allocation-time, you can specify the credits to give now. \n\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003cth\u003eName\u003c/th\u003e\n        \u003cth\u003eType\u003c/th\u003e\n        \u003cth\u003eDesc\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003cth\u003e\u003ccode\u003eslot_id\u003c/code\u003e\u003c/th\u003e\n        \u003cth\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/th\u003e\n        \u003ctd\u003e\n            A unique ID that identifies the slot to allocate. This ID should be unique throughout your project but it doesn't need to be globally unique.\n        \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003cth\u003e\u003ccode\u003emachine_id\u003c/code\u003e\u003c/th\u003e\n        \u003cth\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/th\u003e\n        \u003ctd\u003e\n            The unique ID of the machine that did the computation. This ID is later translated to a user ID by the CreditPiggy server.\n        \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003cth\u003e\u003ccode\u003ecredits\u003c/code\u003e\u003c/th\u003e\n        \u003cth\u003e\u003ccode\u003einteger\u003c/code\u003e\u003c/th\u003e\n        \u003ctd\u003e\n            The number of credits to give to the machine. If \u003ccode\u003ecredits\u003c/code\u003e was defined when allocating the slot, this is ignored. If a \u003ccode\u003emin,max\u003c/code\u003e pair was defined when allocating the slot the value is going to be limited within its bounds.  \n        \u003c/td\u003e\n    \u003c/tr\u003e\n\u003c/table\u003e\n\n### cpapi_counters(slot_id, **kwargs)\n\nSpecify one or more counters that will be accumulated to both machine and user's profile upon claiming the slot. \n\nThis can be useful when giving badges or marking other achievements to the users.\n\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003cth\u003eName\u003c/th\u003e\n        \u003cth\u003eType\u003c/th\u003e\n        \u003cth\u003eDesc\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003cth\u003e\u003ccode\u003eslot_id\u003c/code\u003e\u003c/th\u003e\n        \u003cth\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/th\u003e\n        \u003ctd\u003e\n            A unique ID that identifies the slot to allocate. This ID should be unique throughout your project but it doesn't need to be globally unique.\n        \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003cth\u003e\u003ccode\u003e**kwargs\u003c/code\u003e\u003c/th\u003e\n        \u003cth\u003e\u003ccode\u003eint\u003c/code\u003e\u003c/th\u003e\n        \u003ctd\u003e\n            Any other argument is a named counter, whose value will be accumulated upon claiming.\n        \u003c/td\u003e\n    \u003c/tr\u003e\n\u003c/table\u003e\n\n### cpapi_meta(slot_id, **kwargs)\n\nSpecify one or more metadata for the specified slot. These metadata are mapped to the slot itself and are not aggregated to the user's or machine's profile. \n\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003cth\u003eName\u003c/th\u003e\n        \u003cth\u003eType\u003c/th\u003e\n        \u003cth\u003eDesc\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003cth\u003e\u003ccode\u003eslot_id\u003c/code\u003e\u003c/th\u003e\n        \u003cth\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/th\u003e\n        \u003ctd\u003e\n            A unique ID that identifies the slot to allocate. This ID should be unique throughout your project but it doesn't need to be globally unique.\n        \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003cth\u003e\u003ccode\u003e**kwargs\u003c/code\u003e\u003c/th\u003e\n        \u003cth\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/th\u003e\n        \u003ctd\u003e\n            Any other argument is a named metadata parameter, whose value will be accumulated upon claiming.\n        \u003c/td\u003e\n    \u003c/tr\u003e\n\u003c/table\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwavesoft%2Fpycreditpiggy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwavesoft%2Fpycreditpiggy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwavesoft%2Fpycreditpiggy/lists"}