TruebitProtocol / truebit-eth

Comprehensive repo for creating, issuing, solving, and verifying Truebit tasks on Ethereum
46 stars 3 forks source link

Truebit OS does not delete temp folders of old tasks #13

Open medoledltd opened 3 years ago

medoledltd commented 3 years ago

Truebit OS does not seem to delete the temporary folders created for tasks. It could be a configuration option to delete the folders after x number of days, either during startup of Truebit OS or during task execution. Example to delete folders older than 3 days: find /truebit-eth -name 'tmp.*' -type d -daystart -mtime +3 -delete

perara commented 3 years ago

Just as a supplement, I did this in my wasm proxy tooling which worked quite nice:

**snip**
with tempfile.TemporaryDirectory() as td:
    # Extract zip (job data)
    os.chdir(td)
    self.extract_zip(td, job_data["zip"])

    with DirectoryDiff(td) as directory:
        # Run Task
        proc = subprocess.run(cmd, stdout=subprocess.PIPE)
        result = proc.stdout.decode()
        # Diff task directory and zip new files
        new_files = directory.diff()
        zip_file = self.zip_diff(td, new_files)
**snip**

Could probably be done similarly usingRust