[Chicago-talk] Determining if another perl process is running.
Alan Mead
amead2 at alanmead.org
Mon Mar 17 11:57:33 PDT 2025
Richard,
Naive Bayes. I've used AI::NaiveBayes when I need to automate a
decision, like your spam filter probably uses this algorithm. You train
it by flagging spam and it recalculates the weights of the NB. I wrote a
paper on using NB to classifying exam items into Bloom's taxonomy of
cognitive complexity. This would be handy because most item authors are
not experts in Bloom's taxonomy.
https://jattjournal.net/index.php/atp/article/view/170341
So, one thing you might be missing is a need to automatically classify
written documents into classes.
I think even with the amazingly superior AI we have today, there's still
plenty of space to use "old school" ML (like NB). I asked ChatGPT to
classify items into Bloom's taxonomy and the accuracy was like 20%. But
then I fine-tuned a version of gpt-3.5 on the data we used for our NB
paper and the rate was in the 70-80% range (which is comparable to the
NB paper). In theory, this fine-tuned model "understands" the language
better than my older NB model, which is driven by keywords. But a
salient difference for me was that fine-tuning was like 12 lines of Perl
code and an evening mostly spent learning to use the fine tuning API. We
spent weeks on the analysis of that NB paper. Although lately I've been
reflecting on the disadvantages of being tied to a vendor's fine-tuned
model. I think that model is still available to me, but it won't be
forever.
What you're missing. But what you may be missing, and what I was
referring to, was that LLMs can now write code. You describe the feature
you want, and it writes the code. This is clearly going to be a
disruptive innovation, but the people who are saying that we can replace
coders are (currently) dead wrong. We have long had people who search
for code snippets online and copy them into their code. I think AI just
makes this process more efficient. In my experience, you absolutely need
to be a coder to put the pieces in place and, often enough, debug what
doesn't work.
I use it especially in the situation you are in where I need something I
don't use daily, like a Bash script.
And (to be clear) you should be cautious. You should also be aware of
all the pitfalls. Like (a) the AI being wrong; (b) the current copyright
regime seems very against issuing copyrights for AI-generated output
(probably for good reason); and (c) ChatGPT, for example, might end up
using your input/output to train future versions of the model. There's
also (d) the moral question of whether it's OK to "profit" (in any
sense) from code scraped off the Internet (or God-knows where).
[Although we scraped the exam questions I used in that NB paper... So,
kettles and pots and all...]
About AI being wrong, it's correct a lot, but I've seen it make up Perl
modules and make up calls within existing models. But that's not really
a big deal because the script won't execute and tells you exactly why
not. The really problematic issue is that it definitely includes bugs. I
was too lazy to write a complicated regex so I had ChatGPT write it and
it fails about 2% of the time. Now I have the problem that I need to
expend more effort (at some point) to figure out why the regex fails. In
my application, it's not a big deal; it means an additional +2% error
rate in part of one process in a pipeline that's only abut 90% accurate.
But I shudder to imagine this being used more broadly and without proper
oversight. I have caught more serious bugs. I'm not saying "AI code has
bugs, so don't use it" because non-AI code also has bugs. I'm saying
exercise caution and skepticism. Assume AI-written code has bugs.
-Alan
On 2025-03-17 12:20, Richard Reina wrote:
> The only AI I have messed around with is: AI::NaiveBayes. I have yet to
> find any use for open AI because I guess I lack the imagination to find
> an interesting but sometimes inaccurate chat bot useful. Am I missing
> something?
>
> On Mon, 25 Nov 2024 09:54:06 -0600, Alan Mead <amead2 at alanmead.org>
> wrote:
>
> I like Andy's PID file suggestion, but I would be inclined to make this
> a bash script rather than a perl one-liner and test something like:
>
> `ps aux | grep perl | grep starman`
>
> And if that command causes it's own failure (by always creating a
> process with 'perl' and 'starman') then:
>
> `ps aux | grep [p]erl | grep [s]tarman`
>
> If you find bash scripting not super easy (like me), ChatGPT is very
> helpful. It's helped me a lot in writing better admin scripts.
>
> -Alan
>
> On 11/25/24 9:41 AM, Andy Bach wrote:
>
>> Need to expand your grep RE or add a grep -v to remove the ones you
>> don't want, though, then you have to remove the one you just added.
>> Another is to track the pids, find the ones you've created and look
>> for one outside that set. You could have starman (if it doesn't)
>> create a .pid file and use that to check that pid's status (with lsof
>> -p <pid> maybe), rather than grepping.
>> -------------------------
>>
>> From: Chicago-talk
>> <chicago-talk-bounces+andy_bach=wiwb.uscourts.gov at pm.org> on behalf of
>> Richard Reina <gatorreina at gmail.com>
>> Sent: Sunday, November 24, 2024 5:19 PM
>> To: Chicago.pm chatter <chicago-talk at pm.org>
>> Subject: [Chicago-talk] Determining if another perl process is
>> running.
>>
>> CAUTION - EXTERNAL:
>>
>> Hello everyone,
>>
>> So excited about the Winter Perl Conference that I just registered for
>> that I thought I would rebuild my aged Perl Dancer2 website. I 've
>> done so and deployed it on a Digital Ocean droplet but I've hit a snag
>> in setting up a cron job to make sure starman is running. It seems my
>> query into whether the process is running gets treated as evidence
>> that the process IS running.
>>
>> When I do:
>>
>> perl -e 'my $smstat = `ps -ef | grep starman`; unless ($smstat =~
>> /starman master/) { system("XDG_RUNTIME_DIR=/run/user/1001 exec
>> /home/starman/starman.pl [1] start &>> /home/starman/starman.log");
>> print localtime . " starting starman\n"; } else { print "Starman is
>> already running\n\n\n $smstat\n" }';
>>
>> RESULTS IN:
>>
>> Starman is already running
>>
>> starman 203805 1 0 Nov08 ? 00:00:00
>> /lib/systemd/systemd --user
>> starman 203806 203805 0 Nov08 ? 00:00:00 (sd-pam)
>> root 472040 385 0 Nov20 ? 00:00:00 sshd: starman
>> [priv]
>> starman 472049 472040 0 Nov20 ? 00:00:01 sshd:
>> starman at pts/0
>> starman 472050 472049 0 Nov20 pts/0 00:00:00 -bash
>> starman 544383 472050 0 23:11 pts/0 00:00:00 perl -e my $smstat
>> = `ps -ef | grep starman`; unless ($smstat =~ /starman master/) {
>> system("XDG_RUNTIME_DIR=/run/user/1001 exec /home/starman/starman.pl
>> [1] start &>> /home/starman/starman.log"); print localtime . "
>> starting starman\n"; } else { print "Starman is already running\n\n\n
>> $smstat\n" }
>> starman 544384 544383 0 23:11 pts/0 00:00:00 sh -c ps -ef |
>> grep starman
>> starman 544385 544384 0 23:11 pts/0 00:00:00 ps -ef
>> starman 544386 544384 0 23:11 pts/0 00:00:00 grep starman
>>
>> It always says it's running even if it is not apparently because it's
>> seeing 'starman master/ in the perl script that is inquiring.
>>
>> Anyone know a good solution to avoid this so that I can determine
>> whether my starman startup script is indeed running?
>>
>> CAUTION - EXTERNAL EMAIL: THIS EMAIL ORIGINATED OUTSIDE THE JUDICIARY.
>> EXERCISE CAUTION WHEN OPENING ATTACHMENTS OR CLICKING ON LINKS.
>>
>> _______________________________________________
>> Chicago-talk mailing list
>> Chicago-talk at pm.org
>> https://mail.pm.org/mailman/listinfo/chicago-talk
>
> --
>
> Alan D. Mead, Ph.D.
> President, Talent Algorithms Inc.
>
> science + technology = better workers
>
> https://talalg.com
>
> He who confuses political liberty with freedom and political equality
> with similarity has never thought for five minutes about either.
>
> -- Shaw, from "Maxims for Revolutionists"
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at pm.org
> https://mail.pm.org/mailman/listinfo/chicago-talk
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at pm.org
> https://mail.pm.org/mailman/listinfo/chicago-talk
Links:
------
[1] http://starman.pl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/chicago-talk/attachments/20250317/80d6db17/attachment-0001.html>
More information about the Chicago-talk
mailing list