Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EVA-3533 - Initial version of an orchestrator for submission processing #211

Merged
merged 4 commits into from
Jul 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add tests
tcezard committed Jun 27, 2024
commit c2d5bd2fab07a924956adece52d12440db4bebde
18 changes: 14 additions & 4 deletions eva_sub_cli_processing/process_jobs.py
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@


def _url_build(*args, **kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a docstring stating that args will be used as path params and kwargs as query params

url = cfg.query('submissions', 'ws_url') + '/' + '/'.join(args)
url = cfg.query('submissions', 'webservice', 'url') + '/' + '/'.join(args)
if kwargs:
return url + '?' + '&'.join(f'{k}={v}' for k, v in kwargs.items())
else:
@@ -17,15 +17,15 @@ def _url_build(*args, **kwargs):

@retry(tries=5, backoff=2, jitter=.5)
def _get_submission_api(url):
auth = (cfg.query('submissions', 'ws_admin_username'), cfg.query('submissions', 'ws_admin_password'))
auth = (cfg.query('submissions', 'webservice', 'admin_username'), cfg.query('submissions', 'webservice', 'admin_password'))
response = requests.get(url, auth=auth)
response.raise_for_status()
return response.json()


@retry(tries=5, backoff=2, jitter=.5)
def _put_submission_api(url):
auth = (cfg.query('submissions', 'ws_admin_username'), cfg.query('submissions', 'ws_admin_password'))
auth = (cfg.query('submissions', 'webservice', 'admin_username'), cfg.query('submissions', 'webservice', 'admin_password'))
response = requests.put(url, auth=auth)
response.raise_for_status()
return response.json()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine for the initial version but I would reiterate what I wrote in the second half of this comment about a client class for the submission-ws. This way all our Python code can use the web service uniformly, just configured using admin credentials when necessary.

@@ -52,7 +52,7 @@ def _process_submission(submission):

class SubmissionScanner(AppLogger):

statuses = ['UPLOADED', 'PROCESSING']
statuses = []

def scan(self):
submissions = []
@@ -74,7 +74,13 @@ def report(self):
pretty_print(header, lines)


class NewSubmissionScanner(SubmissionScanner):

statuses = ['UPLOADED']


class Submission(AppLogger):

def __init__(self, submission_id, submission_status, uploaded_time):
self.submission_id = submission_id
self.submission_status = submission_status
@@ -87,3 +93,7 @@ def start(self):
def submit_pipeline(self):
# TODO: Actually submit a job for this submission
pass

def __repr__(self):
return f'Submission(submission_id={self.submission_id}, submission_status={self.submission_status}, ' \
f'uploaded_time={self.uploaded_time})'
6 changes: 6 additions & 0 deletions tests/resources/submission_config.yml
Original file line number Diff line number Diff line change
@@ -45,3 +45,9 @@ ena:
ftpport: 22
username: demo
password: password

submissions:
webservice:
admin_username: admin
admin_password: password
url: https://test.com