plotman icon indicating copy to clipboard operation
plotman copied to clipboard

Facilitate ease of use around plotman being run as a service

Open BasilHorowt opened this issue 4 years ago • 4 comments

from #177

My imagination is that plotman plot would end up being used as a service and you would systemctl start plotman and systemctl stop plotman etc. You could enable it to start on boot. When it crashed it would be restarted. I presume that would handle log rolling of our output, etc. I don't know a specific reason you couldn't set this up now, but I also haven't actually done it or heard of anyone doing it. This would be significantly more useful with a monitoring version of interactive mode. Or at least a plotman interactive --monitor cli option.

BasilHorowt avatar May 09 '21 06:05 BasilHorowt

@altendky My issue title here might not be the best

BasilHorowt avatar May 09 '21 06:05 BasilHorowt

It looks it can be achieved in Linux with relative low effort:

  1. plotman plot continues to behave as it currently does
  2. We add an extra check to make sure the user isn't trying to start another instance (e.g, different terminals, another process in background etc). This can be done by simply looking at the processes table
  3. Add a flag --stop that kills the process using the PID from the processes table
  4. install to systemd (see links below)

rafaelsteil avatar May 10 '21 22:05 rafaelsteil

if I run plotman plot as command inside systemd service and later stop the service with sudo service plotman stop it stops! ALL the plotting jobs!!! started by this command. It was a big surprise for me when plotman status didn't show me 20+ started earlier jobs by this service. Any way to run plotman as a service and not to stop plotting jobs if the service is stopped?

plotman version used: 0.3.1 service config:

[Unit] Description=Plotman Service After=network.target [Service] ExecStart=/home/chia/plotman/plotman.sh WorkingDirectory=/home/chia/plotman StandardOutput=inherit StandardError=inherit Restart=always User=chia [Install] WantedBy=multi-user.target

plotman.sh content

#!/bin/sh

cd /home/chia/chia-blockchain . ./activate

plotman plot 2>&1 | tee /home/chia/plotman/plotman.log

andrew-kratik avatar Jun 01 '21 17:06 andrew-kratik

@andrew-kratik, that sounds like a bug to me. Feel free to open a dedicated ticket. Efforts are already made to disassociate the plotting processes from the plotman processes. If that's not working then it should be addressed directly. Maybe you could check if there is a difference between when plotman plot is run directly and then killed as opposed to run by systemd and then killed?

In general, yes, plotman is already somewhat broken up into pieces, but there are lots of pointy corners in that usage. plotman plot doesn't archive. plotman interactive plots. etc... And we'll have to deal with a user mindset shift away from plotman interactive does everything, or make it so it still does.

altendky avatar Jun 05 '21 19:06 altendky