From 55ba8af3433c33c9ba2a54c6d698d85e510531f6 Mon Sep 17 00:00:00 2001 From: Keigh Rim Date: Mon, 24 Jul 2023 01:38:45 -0400 Subject: [PATCH] updated to sdk 1.0.9 --- .dockerignore | 5 +++-- .github/workflows/issue-apps-project.yml | 2 +- .github/workflows/issue-close.yml | 2 +- Containerfile | 10 +++++++++- README.md | 4 +++- app.py | 18 +++++++++--------- metadata.py | 7 +++++-- requirements.txt | 2 +- 8 files changed, 32 insertions(+), 18 deletions(-) diff --git a/.dockerignore b/.dockerignore index ff2e8ff..8c35d6c 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,13 +1,14 @@ .git/ .github/ .gitignore +.dockerignore +Dockerfile +Containerfile bin/ build/ *~ **/*.pyc **/__pyche__ -.dockerignore -ContainerFile outerdemo.sh wgbh-audios/ demo/results/ diff --git a/.github/workflows/issue-apps-project.yml b/.github/workflows/issue-apps-project.yml index 032ecd0..1e811f9 100644 --- a/.github/workflows/issue-apps-project.yml +++ b/.github/workflows/issue-apps-project.yml @@ -5,7 +5,7 @@ on: types: - opened - transferred - pull_request: + pull_request_target: types: - opened diff --git a/.github/workflows/issue-close.yml b/.github/workflows/issue-close.yml index 8f56703..48d38b2 100644 --- a/.github/workflows/issue-close.yml +++ b/.github/workflows/issue-close.yml @@ -4,7 +4,7 @@ on: issues: types: - closed - pull_request: + pull_request_target: types: - closed diff --git a/Containerfile b/Containerfile index 2a6c7c9..3cb4755 100644 --- a/Containerfile +++ b/Containerfile @@ -1,4 +1,12 @@ -FROM ghcr.io/clamsproject/clams-python-ffmpeg-tf2:1.0.2 +# Use the same base image version as the clams-python python library version +FROM ghcr.io/clamsproject/clams-python-ffmpeg-tf2:1.0.9 +# See https://github.com/orgs/clamsproject/packages?tab=packages&q=clams-python for more base images +# IF you want to automatically publish this image to the clamsproject organization, +# 1. you should have generated this template without --no-github-actions flag +# 1. to add arm64 support, change relevant line in .github/workflows/container.yml +# * NOTE that a lots of software doesn't install/compile or run on arm64 architecture out of the box +# * make sure you locally test the compatibility of all software dependencies before using arm64 support +# 1. use a git tag to trigger the github action. You need to use git tag to properly set app version anyway ################################################################################ # DO NOT EDIT THIS SECTION diff --git a/README.md b/README.md index 490c03f..e334a46 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,6 @@ This is a CLAMS app that wraps [Brandeis-ACS](https://pypi.org/project/brandeis-acs/) tool. -General user instruction for CLAMS apps is available at [CLAMS Apps documentation](https://apps.clams.ai/clamsapp/). +## User instruction + +General user instructions for CLAMS apps is available at [CLAMS Apps documentation](https://apps.clams.ai/clamsapp). diff --git a/app.py b/app.py index 47e9aab..786f0e4 100644 --- a/app.py +++ b/app.py @@ -1,13 +1,13 @@ import argparse +import logging import os import tempfile -from typing import Union, Dict - -import bacs from clams import ClamsApp, Restifier from mmif import Mmif, View, Document, AnnotationTypes, DocumentTypes +from typing import Union, Dict import metadata +import bacs class BrandeisAcs(ClamsApp): @@ -88,11 +88,9 @@ def run_bacs(self, files: list) -> (list, list): if __name__ == "__main__": parser = argparse.ArgumentParser() - parser.add_argument( - "--port", action="store", default="5000", help="set port to listen" - ) + parser.add_argument("--port", action="store", default="5000", help="set port to listen" ) parser.add_argument("--production", action="store_true", help="run gunicorn server") - # more arguments as needed + # add more arguments as needed # parser.add_argument(more_arg...) parsed_args = parser.parse_args() @@ -100,9 +98,11 @@ def run_bacs(self, files: list) -> (list, list): # create the app instance app = BrandeisAcs() - http_app = Restifier(app, port=int(parsed_args.port) - ) + http_app = Restifier(app, port=int(parsed_args.port)) + # for running the application in production mode if parsed_args.production: http_app.serve_production() + # development mode else: + app.logger.setLevel(logging.DEBUG) http_app.run() diff --git a/metadata.py b/metadata.py index 03a101e..6d9cb73 100644 --- a/metadata.py +++ b/metadata.py @@ -4,6 +4,7 @@ DO NOT CHANGE the name of the file """ import re +from clams.app import ClamsApp from clams.appmetadata import AppMetadata from mmif import DocumentTypes, AnnotationTypes @@ -44,5 +45,7 @@ def appmetadata() -> AppMetadata: # DO NOT CHANGE the main block if __name__ == '__main__': import sys - - sys.stdout.write(appmetadata().jsonify(pretty=True)) + metadata = appmetadata() + for param in ClamsApp.universal_parameters: + metadata.add_parameter(**param) + sys.stdout.write(metadata.jsonify(pretty=True)) diff --git a/requirements.txt b/requirements.txt index 6bbcf40..57f99d2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -clams-python==1.0.2 +clams-python==1.0.9 brandeis-acs==1.11