Skip to content
Snippets Groups Projects
Commit c7e86b5b authored by Daniel Lyons's avatar Daniel Lyons
Browse files

Add Vulture: sketch of a tool for executing HTCondor input files locally

parent a958cf67
No related branches found
No related tags found
No related merge requests found
# Vulture
Vulture is a fake HTCondor. It doesn't submit jobs to a cluster, instead it runs them locally.
This tool is intended to bypass HTCondor for integration testing purposes.
#!/usr/bin/python
# -*- coding: utf-8 -*-
from pathlib import Path
from setuptools import setup
VERSION = open('src/vulture/_version.py').readlines()[-1].split()[-1].strip("\"'")
README = Path('README.md').read_text()
tests_require = [
'pytest>=5.4,<6.0'
]
setup(
name='ssa-' + Path().absolute().name,
version=VERSION,
description='HTCondor fake executor.',
long_description=README,
author='NRAO SSA Team',
author_email='dms-ssa@nrao.edu',
url='TBD',
license="GPL",
# install_requires=requires,
tests_require=tests_require,
keywords=[],
packages=['vulture'],
package_dir={'':'src'},
classifiers=[
'Programming Language :: Python :: 3.8'
],
entry_points={
'console_scripts': ['vulture = vulture.execute:main']
},
)
""" Version information for this package, don't put anything else here. """
___version___ = '4.0.0a1.dev1'
class Job:
@staticmethod
def parse(file):
job = Job()
# do something here to iterate the file contents and parse it
raise NotImplementedError
def execute(self):
raise NotImplementedError
class Dag:
@staticmethod
def parse(file):
dag = Dag()
# do something here to iterate the file contents and parse it
raise NotImplementedError
def execute(self):
raise NotImplementedError
"""
CLI to our fake dagman executor and fake job executor
"""
import argparse as ap
from pathlib import Path
def execute_dag(file: Path):
"""
Execute the DAG in the given file.
:param file:
:return:
"""
dag = Dag.parse(file)
dag.execute()
def execute_job(file: Path):
"""
Execute the job in the given file.
:param file:
:return:
"""
job = Job.parse(file)
job.execute()
def main():
parser = ap.ArgumentParser('vulture', description='Tool to run HTCondor job specs and DAG workflows locally')
subparsers = parser.add_subparsers()
dag = subparsers.add_parser('dag', help='DAG operations')
sub2 = dag.add_subparsers()
execute = sub2.add_parser('execute', description='Execute an HTCondor DAGMAN DAG')
execute.set_defaults(func=execute_dag)
execute.add_argument('file', nargs=1, type=Path, help='DAGMAN file to execute')
job = subparsers.add_parser('job', help='Job operations')
sub2 = job.add_subparsers()
execute = sub2.add_parser('execute', description='Execute an HTCondor job specification')
execute.set_defaults(func=execute_job)
execute.add_argument('file', nargs=1, type=Path, help='Job file to execute')
args = parser.parse_args()
if 'func' in args and 'file' in args:
args.func(args.file)
else:
parser.print_usage()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment