# Path: studio/artifacts/artifacts_tracker.py
# def get_studio_home():
#     if STUDIOML_HOME in os.environ.keys():
#         return os.environ[STUDIOML_HOME]
#     return os.path.join(os.path.expanduser('~'), '.studioml')
# 
# Path: studio/storage/storage_setup.py
# def get_storage_verbose_level():
#     global _storage_verbose_level
#     return _storage_verbose_level
# 
# Path: studio/util/logs.py
# DEBUG = logging.DEBUG
# INFO = logging.INFO
# ERROR = logging.ERROR
# def get_logger(name):
# def debug(line):
# def error(line):
# def info(line):
# 
# Path: studio/util/util.py
# def check_for_kb_interrupt():
#     current_exc = sys.exc_info()[1]
#     if current_exc is None:
#         return
#     if isinstance(current_exc, KeyboardInterrupt):
#         raise current_exc
#     return
# 
# def rm_rf(path):
#     '''
#     remove file or a directory
#     '''
#     if not os.path.exists(path):
#         return
# 
#     if os.path.isfile(path):
#         os.remove(path)  # remove the file
#     elif os.path.isdir(path):
#         shutil.rmtree(path)  # remove dir and all contains
#     else:
#         raise ValueError("file {0} is not a file or dir.".format(path))


import os
import uuid
import time
import filelock
from studio.artifacts.artifacts_tracker import get_studio_home
from studio.storage.storage_setup import get_storage_verbose_level
from studio.util import logs
from studio.util.util import check_for_kb_interrupt, rm_rf
        if is_active:
            try:
                with self._lock:
                    files = os.listdir(self.path)
                    files.remove(LOCK_FILE_NAME)
                    return True, files
            except BaseException as exc:
                check_for_kb_interrupt()
                self._logger.info("FAILED to get queue status for %s - %s",
                                  self.path, exc)
                # Ignore possible exception:
                # we just want list of files without internal lock file
        return False, list()

    def _get_queue_directory(self):
        queue_dir: str = os.path.join(
            get_studio_home(),
            'queue')
        return queue_dir

    def has_next(self):
        is_active, files = self._get_queue_status()
        return is_active and len(files) > 0

    def is_active(self):
        is_active = os.path.isdir(self.path)
        return is_active

    def clean(self, timeout=0):
        _ = timeout

# Path: studio/artifacts/artifacts_tracker.py
# def get_studio_home():
#     if STUDIOML_HOME in os.environ.keys():
#         return os.environ[STUDIOML_HOME]
#     return os.path.join(os.path.expanduser('~'), '.studioml')
# 
# Path: studio/storage/storage_setup.py
# def get_storage_verbose_level():
#     global _storage_verbose_level
#     return _storage_verbose_level
# 
# Path: studio/util/logs.py
# DEBUG = logging.DEBUG
# INFO = logging.INFO
# ERROR = logging.ERROR
# def get_logger(name):
# def debug(line):
# def error(line):
# def info(line):
# 
# Path: studio/util/util.py
# def check_for_kb_interrupt():
#     current_exc = sys.exc_info()[1]
#     if current_exc is None:
#         return
#     if isinstance(current_exc, KeyboardInterrupt):
#         raise current_exc
#     return
# 
# def rm_rf(path):
#     '''
#     remove file or a directory
#     '''
#     if not os.path.exists(path):
#         return
# 
#     if os.path.isfile(path):
#         os.remove(path)  # remove the file
#     elif os.path.isdir(path):
#         shutil.rmtree(path)  # remove dir and all contains
#     else:
#         raise ValueError("file {0} is not a file or dir.".format(path))


# Path: studio/queues/local_queue.py
import os
import uuid
import time
import filelock
from studio.artifacts.artifacts_tracker import get_studio_home
from studio.storage.storage_setup import get_storage_verbose_level
from studio.util import logs
from studio.util.util import check_for_kb_interrupt, rm_rf

        if is_active:
            try:
                with self._lock:
                    files = os.listdir(self.path)
                    files.remove(LOCK_FILE_NAME)
                    return True, files
            except BaseException as exc:
                check_for_kb_interrupt()
                self._logger.info("FAILED to get queue status for %s - %s",
                                  self.path, exc)
                # Ignore possible exception:
                # we just want list of files without internal lock file
        return False, list()

    def _get_queue_directory(self):
        queue_dir: str = os.path.join(
            get_studio_home(),
            'queue')
        return queue_dir

    def has_next(self):
        is_active, files = self._get_queue_status()
        return is_active and len(files) > 0

    def is_active(self):
        is_active = os.path.isdir(self.path)
        return is_active

    def clean(self, timeout=0):
        _ = timeout

        rm_rf(self.path)