Commit 32441b27 authored by Antoine Kaufmann's avatar Antoine Kaufmann
Browse files

experiments: introduce mkdir and rmtree in executor

parent 0fe2c879
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
import asyncio import asyncio
import shlex import shlex
import os import os
import pathlib
import shutil
import signal import signal
class HostConfig(object): class HostConfig(object):
...@@ -205,6 +207,12 @@ class Executor(object): ...@@ -205,6 +207,12 @@ class Executor(object):
async def send_file(self, path, verbose=False): async def send_file(self, path, verbose=False):
raise NotImplementedError("Please Implement this method") raise NotImplementedError("Please Implement this method")
async def mkdir(self, path, verbose=False):
raise NotImplementedError("Please Implement this method")
async def rmtree(self, path, verbose=False):
raise NotImplementedError("Please Implement this method")
# runs the list of commands as strings sequentially # runs the list of commands as strings sequentially
async def run_cmdlist(self, label, cmds, verbose=True, host=None): async def run_cmdlist(self, label, cmds, verbose=True, host=None):
i = 0 i = 0
...@@ -227,3 +235,9 @@ class LocalExecutor(Executor): ...@@ -227,3 +235,9 @@ class LocalExecutor(Executor):
async def send_file(self, path, verbose): async def send_file(self, path, verbose):
# locally we do not need to do anything # locally we do not need to do anything
pass pass
async def mkdir(self, path, verbose=False):
pathlib.Path(path).mkdir(parents=True, exist_ok=True)
async def rmtree(self, path, verbose=False):
shutil.rmtree(path, ignore_errors=True)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment