Skip to content
Snippets Groups Projects
Commit cd1d73c1 authored by Charlotte Hausman's avatar Charlotte Hausman
Browse files

proof of concept for update_stage

parent 8acd6fd5
No related branches found
No related tags found
1 merge request!1204proof of concept for update_stage
Pipeline #8167 failed
......@@ -25,15 +25,12 @@ from setuptools import find_packages, setup
VERSION = open("update_stage/_version.py").readlines()[-1].split()[-1].strip("\"'")
README = Path("README.md").read_text()
requires = [
"pycapo",
"requests",
]
requires = ["htchirp", "pex==2.1.119"]
setup(
name="ssa-" + Path().absolute().name,
version=VERSION,
description="Update Stage allows for progress visibility into currently running HTCondor DAGs",
description="Update Stage allows for progress visibility into currently running HTCondor workflows",
long_description=README,
author="NRAO SSA Team",
author_email="dms-ssa@nrao.edu",
......
......@@ -2,12 +2,10 @@
Allows for tracking current stage of in-progress DAGs.
"""
import argparse
import logging
from argparse import ArgumentParser
from http import HTTPStatus
import requests
from pycapo import CapoConfig
from requests import Response
import datetime
import htchirp
def parser() -> ArgumentParser:
......@@ -21,50 +19,45 @@ def parser() -> ArgumentParser:
formatter_class=argparse.RawTextHelpFormatter,
)
parser.add_argument(
"request_id",
type=int,
"stage",
type=str,
action="store",
help="the workflow request ID of the running workflow",
help="the stage name of the running workflow",
)
parser.add_argument(
"--complete",
action="store_true",
help="this stage is complete",
)
return parser
def send_update(message: dict):
def send_update(message: str):
"""
Make use of HTCondor Chirp Protocol to update stage
:param message: the dict containing message parameters
"""
with htchirp.HTChirp() as chirp:
chirp.ulog(message)
pass
def build_message(args: argparse.Namespace) -> dict:
def build_message(args: argparse.Namespace) -> str:
"""
Build message dict
:param args:
:return:
"""
message = {}
if args.casa:
message["current_stage"] = "CASA_ENVOY"
message["previous_stage"] = "FETCH"
if args.auto_qa:
message["current_stage"] = "AUTO_QA"
message["previous_stage"] = "CASA_ENVOY"
if args.convey:
message["current_stage"] = "CONVEY"
message["previous_stage"] = "CASA_ENVOY"
if args.vlass:
message["is_vlass"] = True
if args.complete:
state = "Completed"
else:
message["is_vlass"] = False
state = "Started"
time = datetime.datetime.now()
return message
return f"WS STAGE UPDATE: Stage {str(args.stage).upper()} has {state} at {time}."
def main():
......
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