{"id":16410297,"url":"https://github.com/ctrlcctrlv/python-atd","last_synced_at":"2025-03-23T06:31:04.700Z","repository":{"id":52169149,"uuid":"42573053","full_name":"ctrlcctrlv/python-atd","owner":"ctrlcctrlv","description":"The Unix `at` scheduler in Python. Supports atq, atd, atrm...","archived":false,"fork":false,"pushed_at":"2022-12-16T09:08:49.000Z","size":31,"stargazers_count":10,"open_issues_count":0,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-17T20:13:54.674Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ctrlcctrlv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-16T07:53:58.000Z","updated_at":"2024-05-07T02:39:45.000Z","dependencies_parsed_at":"2022-09-05T01:50:26.342Z","dependency_job_id":null,"html_url":"https://github.com/ctrlcctrlv/python-atd","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrlcctrlv%2Fpython-atd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrlcctrlv%2Fpython-atd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrlcctrlv%2Fpython-atd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrlcctrlv%2Fpython-atd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ctrlcctrlv","download_url":"https://codeload.github.com/ctrlcctrlv/python-atd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245066496,"owners_count":20555402,"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-10-11T06:23:49.109Z","updated_at":"2025-03-23T06:31:03.544Z","avatar_url":"https://github.com/ctrlcctrlv.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"atd package (v0.2.2)\n====================\n\nhttps://pypi.org/project/python-atd/\n\nat is the companion of cron. While cron says \"execute command every 5 minutes\",\nat says, \"execute command once at exactly 2:00 PM\". at is the original Unix\nscheduler.\n\nThis Python module aims to support all at operations in a safe way.\n\nInstallation\n============\n\n```bash\npip install python-atd\n```\n\nTests\n=====\n\nIf installing from repository with `python setup.py install`, it's recommended\nto run the tests to make sure at is configured properly.\n\nSupports Python 2 and Python 3.\n\nSimple usage example\n====================\n\n```python3\nfrom atd import atd\nimport datetime\n\nprint('Create some jobs...')\njob1 = atd.at(\"echo lol \u003e\u003e /tmp/lolol\", datetime.datetime.now() + \n\tdatetime.timedelta(minutes = 2))\njob2 = atd.at(\"rm /tmp/lolol\", datetime.timedelta(minutes=5))\n\nprint(\"Job 1: {0}\".format(job1))\nprint(\"Job 2: {0}\".format(job2))\n\nprint('All right, free up those vars...')\ndel job1; del job2\n\nprint('Check our atd queue for our jobs (`atq`)')\natq = atd.AtQueue()\nprint [str(job) for job in atq.jobs]\n\nprint('Cancel all our jobs.')\nprint [atd.atrm(job) for job in atq.jobs]\n\nprint('Refresh the AtQueue...')\natq.refresh()\n\nprint('Poof!')\nprint [str(job) for job in atq.jobs]\n```\n\nSubmodules\n==========\n\natd module\n==========\n\nat(command, when, queue='a')\n\n\u003e Execute command at when.\n\u003e\n\u003e command may be anything interpreble by /bin/sh. If you need features specific\n\u003e to another shell, create a script and then make the command \u0026lt;path to\n\u003e shell\u0026gt; \u0026lt;path to script\u0026gt;.\n\u003e\n\u003e when may be a datetime.timedelta, a datetime.datetime or a timespec str. If a\n\u003e string is provided, it is assumed that it's a valid timespec. See *timespec*\n\u003e doc in at's documentation.\n\u003e \n\u003e python-atd also has good support for named queues. Both GNU and BSD at\n\u003e support the concept of named queues, which allow you to easily separate\n\u003e different types of jobs based on type.For example, if you owned a bank, you'd\n\u003e have different types of jobs. Check clearing might go in queue \"c\" 24 hours\n\u003e after request, while international wire clearing would go in queue \"i\" 48\n\u003e hours after request. An unfortunate limitation of at is that all jobs can\n\u003e only be one letter, A-Z or a-z. This means there are only 52 available queues\n\u003e in both BSD at and GNU at.\n\natrm(\\*atjobs)\n\n\u003e Cancel one or more AtJobs. Takes an AtJob instance returned by at(). You may\n\u003e also choose to save the at job ID in a database, and pass its ID to cancel().\n\nclear(queue = False)\n\n\u003e Cancel all atjobs. You may also specify a queue.\n\nconvert\\_datetime(dt)\n\n\u003e Convert a datetime object to a POSIX timestamp usable by at. It returns a\n\u003e string.\n\u003e\n\u003e From the at manual: -t Specify the job time using the POSIX time format. The\n\u003e argument should be in the form \\[\\[CC\\]YY\\]MMDDhhmm\\[.SS\\].\n\nconvert\\_timedelta(td)\n\n\u003e Convert a timedelta object to a timespec usable by at. Note that at does not\n\u003e understand seconds, so extra seconds are rounded down.\n\nget\\_allowed\\_users()\n\n\u003e Get a list() of all users allowed to use at, or raise an OSError if we can't\n\u003e determine it for some reason.\n\nget\\_denied\\_users()\n\n\u003e Get a list() of all users disallowed from at, or raise an OSError if we can't\n\u003e determine it for some reason.\n\natq module\n==========\n\nclass class atq.AtJob(jobid=0, load=False)\n\n\u003e Bases: \"object\"\n\u003e\n\u003e from\\_at\\_stderr(stderr)\n\u003e\n\u003e \u003e Called by at(), it creates an AtJob from at's stderr.\n\u003e\n\u003e load()\n\u003e\n\u003e \u003e For performance reasons, information about atjobs is lazy-loaded on request\n\u003e \u003e (see \\_\\_get\\_\\_()). However, you can force load all of it with this\n\u003e \u003e function, for example for pretty instantaneous JSON output from\n\u003e \u003e \\_\\_repr\\_\\_().\n\nclass class atq.AtQueue(queue=False)\n\n\u003e Bases: \"object\"\n\u003e\n\u003e The AtQueue class represents the state of the at queue at the time when it\n\u003e was initialized. Jobs are stored as a list in AtQueue.jobs.\n\u003e\n\u003e find\\_job\\_by\\_id(id)\n\u003e\n\u003e \u003e Simply iterate through AtQueue.jobs and return the job with the given id.\n\u003e \u003e Raise ValueError if no job in AtQueue.\n\u003e\n\u003e refresh()\n\u003e\n\u003e \u003e Refresh this AtQueue, reading from atq again. This is automatically called\n\u003e \u003e on instantiation. self.jobs becomes a list of AtJob objects.\n\nconfig module\n=============\n\ntests module\n============\n\nclass class tests.NoNullAtJobComparisonTest(methodName='runTest')\n\n\u003e Bases: \"unittest.case.TestCase\"\n\u003e\n\u003e test\\_null\\_atjob\\_comparison()\n\nclass class tests.ScheduleTests(methodName='runTest')\n\n\u003e Bases: \"unittest.case.TestCase\"\n\u003e\n\u003e test\\_at\\_cancel()\n\nclass class tests.TimeConversionTests(methodName='runTest')\n\n\u003e Bases: \"unittest.case.TestCase\"\n\u003e\n\u003e test\\_datetime()\n\u003e\n\u003e test\\_timedelta()\n\nModule contents\n===============\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fctrlcctrlv%2Fpython-atd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fctrlcctrlv%2Fpython-atd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fctrlcctrlv%2Fpython-atd/lists"}