plotman icon indicating copy to clipboard operation
plotman copied to clipboard

When killing a job, plotman does not delete temp files

Open rjsears opened this issue 4 years ago • 4 comments

Killed server jobs with the command ./plotman.py kill xxxx, plotman correctly identifies the job and plot and asks if I want to kill it. When I said yes, it errors out saying that it cannot find the log file. The plot process is killed but I have to manually go in and delete all the temp files from the temp directory.

rjsears avatar Mar 29 '21 04:03 rjsears

Sorry to double back on this. I thought this was fixed with someone else's commit. Are you still seeing this issue with the latest from the development branch?

ericaltendorf avatar Apr 01 '21 04:04 ericaltendorf

**Update, this comment was written while I had error-prone memory and I was only killing halted processes that crashed due to the memory issue. It might not be the case if the process is behaving properly.

I'm seeing this issue with development branch currently. Right now the process is used to get the temp files.

    def get_temp_files(self):
        # Prevent duplicate file paths by using set.
        temp_files = set([])
        for f in self.proc.open_files():
            if self.tmpdir in f.path or self.tmp2dir in f.path or self.dstdir in f.path:
                temp_files.add(f.path)
        return temp_files

Doing a plot name match would pick up all the files. E.g.

    def get_temp_files(self):
        # Prevent duplicate file paths by using set.
        temp_files = set([])
        for f in self.proc.open_files():
            if self.tmpdir in f.path or self.tmp2dir in f.path or self.dstdir in f.path:
                temp_files.add(f.path)
        with os.scandir(self.tmpdir) as it:
            for entry in it:
                if self.plot_id in entry.name:
                    try:
                        temp_files.add(entry.path)
                    except FileNotFoundError:
                        # The file might disappear
                        pass
        if self.tmp2dir:   
            with os.scandir(self.tmp2dir) as it:
                for entry in it:
                    if self.plot_id in entry.name:
                        try:
                            temp_files.add(entry.path)
                        except FileNotFoundError:
                            # The file might disappear
                            pass
        return temp_files

mikehw avatar Apr 19 '21 22:04 mikehw

Is this still a problem? Not sure if this relates: https://github.com/ericaltendorf/plotman/issues/181

BasilHorowt avatar May 09 '21 06:05 BasilHorowt

I still have this problem.

It never deletes temp files.

jd1900 avatar Jun 07 '21 08:06 jd1900