From ad29286e5e2b95b89139325d63d079d211ee44bc Mon Sep 17 00:00:00 2001 From: Aleteoryx Date: Tue, 23 Dec 2025 22:03:55 -0500 Subject: [PATCH] taken.py --- COPYING | 16 ++++++++++++++++ taken.py | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 COPYING create mode 100755 taken.py diff --git a/COPYING b/COPYING new file mode 100644 index 0000000000000000000000000000000000000000..fced2fa30dc74e80604c9ab4336549cffe3363ad --- /dev/null +++ b/COPYING @@ -0,0 +1,16 @@ +this software distributed under a "fuck around, find out" license. the +author gives nobody in the world any explicit legal right to use this +code for any purpose whatsoever. the author reserves the right to send +holy legal fury down from the heavens should you invoke her ire. + +the author does not have the money to do so, in any juris diction +worldwide. the author is also prety chill, she thinks, so, you know, do +what you want or whatever. the text of this license is intentionally +god damn stupid specifically to scare away corporate lawyers and +attract internet queers + +if you do choose to redistribute this software (to "fuck around", as it +were), you should change this disclaimer some and make it funnier + +the mitochondrea is the powerhouse of the cell + diff --git a/taken.py b/taken.py new file mode 100755 index 0000000000000000000000000000000000000000..1218088d8310055bb9432a4084eef47a8322cf9f --- /dev/null +++ b/taken.py @@ -0,0 +1,52 @@ +#!/bin/env python3 + +import socket +from sys import argv, stderr, exit + +argv0 = 'taken.py' + +def usage(): + global argv0 + print(f'usage: {argv0} ', file=stderr) + exit(-1) + +def send_cmd(reader, writer, cmd): + lines = [] + + writer.write(cmd.encode()+b'\n') + writer.flush() + while True: + line = reader.readline() + if line == b'?\n': + raise Exception('bad cmd') + elif line == b'OKAY\n': + return lines + else: + lines.append(line.decode().strip()) + + +if len(argv) > 0: + argv0 = argv[0] + argv = argv[1:] +if len(argv) != 2: + usage() +host, port = argv + +sok = socket.create_connection((host, port)) +reader, writer = sok.makefile('rb'), sok.makefile('wb') + +taken = send_cmd(reader, writer, 'list taken jobs') +for job in taken: + jid = job.split('\t',1)[0] + + print(f'job {jid}:') + + info = send_cmd(reader, writer, f'info for job {jid} is') + for line in info: + print(f'\t{line}') + print() + + meta = send_cmd(reader, writer, 'meta is') + for line in meta: + print(f'\t{line}') + print()