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

Data dispatcher implementation #13

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
7bcd145
created data dispatcher class, test page, and config file
LTrestka May 30, 2023
b30344f
changed data_dispatcher name
LTrestka May 31, 2023
f1a91b7
Data dispatcher test page now has the ability to log in with username…
LTrestka Jun 9, 2023
40793fc
Merge branch 'data_dispatcher_implementation' of https://github.com/f…
LTrestka Jun 9, 2023
991943b
merge conflict resolved
LTrestka Jun 9, 2023
939f438
* Data dispatcher implemented up to the point of submission.
LTrestka Jul 18, 2023
94d4551
Cleaned up UI, added stability and compatibility between sam and data…
LTrestka Jul 31, 2023
6ff236b
submission broker looks at all existing launches at once and quickly …
Aug 15, 2023
6fbc33d
Updated submission agent to fetch data dispatcher jobs
LTrestka Aug 15, 2023
f0757b4
Updates to submission agent to fix broken jobsub_id format.
LTrestka Aug 21, 2023
373e207
Added a "dataset only" option for dd submissions, which is automatica…
LTrestka Aug 22, 2023
04d10ce
Finishing touches with faster queries, updates to split types (to run…
LTrestka Aug 29, 2023
72d766c
Several minor Bug fixes
LTrestka Sep 2, 2023
56b37b8
LTrestka Oct 4, 2023
941afbb
added docs
LTrestka Oct 26, 2023
c82e1d7
Refined docs for github
LTrestka Nov 7, 2023
2c01090
added html
LTrestka Nov 7, 2023
f1e7486
Updates to dd login
LTrestka Nov 7, 2023
bd9171c
Added the ability to use campaign keywords in campaign/stage fields -…
LTrestka Nov 7, 2023
4c30b7e
* Added test split functionality
LTrestka Dec 8, 2023
05f0c0e
added files to gitignore
LTrestka Dec 8, 2023
ade1723
LTrestka Dec 8, 2023
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
Added the ability to use campaign keywords in campaign/stage fields -…
… which are formatted when creating a snapshot
  • Loading branch information
LTrestka committed Nov 7, 2023
commit bd9171c18301cdab80bfeb6784f054f2cbef6b2e
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ tmp
__pycache__
fife_wrap.py
fife_wrap
submission_broker/submission_broker_uwsgi.ini
submission_broker/submission_broker_uwsgi.ini
bin/db_equalizer.py
bin/db_equalizing_script.sql
33 changes: 29 additions & 4 deletions webservice/MiscPOMS.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import cherrypy
from crontab import CronTab
from sqlalchemy import and_, distinct, func, or_, text, Integer
from sqlalchemy import and_, distinct, func, or_, text, Integer, String
from sqlalchemy.exc import IntegrityError, SQLAlchemyError
from sqlalchemy.orm import joinedload, attributes, aliased

Expand Down Expand Up @@ -651,7 +651,7 @@ def get_recovery_list_for_campaign_def(self, ctx, campaign_def):
return rlist

# h3. snapshot_parts
def snapshot_parts(self, ctx, s, campaign_stage_id):
def snapshot_parts(self, ctx, s, campaign_stage_id, keywords=None):

cs = ctx.db.query(CampaignStage).filter(CampaignStage.campaign_stage_id == campaign_stage_id).one()
for table, snaptable, field, sfield, sid, tfield in [
Expand All @@ -678,9 +678,34 @@ def snapshot_parts(self, ctx, s, campaign_stage_id):
if i[0] is None or j is None or j.updated is None or i[0] < j.updated:
newsnap = snaptable()
columns = j._sa_instance_state.class_.__table__.columns
if keywords:
logit.log(f"keywords: {keywords}")
for fieldname in list(columns.keys()):

setattr(newsnap, fieldname, getattr(j, fieldname))
if keywords:
try:
def navigate(item):
if isinstance(item, str):
for keyword in keywords.keys():
if f"%({keyword})s" in item:
item = item.replace(f"%({keyword})s", keywords[keyword])
elif isinstance(item, dict):
item = item % keywords
elif isinstance(item, list):
for i in range(0, len(item)):
item[i] = navigate(item[i])
return item
value = navigate(getattr(j, fieldname))
setattr(newsnap, fieldname, value)
except KeyError as e:
logit.log(f"Key error: {e}")
pass
except ValueError as e:
logit.log(f"Value error: {e}")
pass
except Exception:
setattr(newsnap, fieldname, getattr(j, fieldname))
else:
setattr(newsnap, fieldname, getattr(j, fieldname))
ctx.db.add(newsnap)
else:
newsnap = ctx.db.query(snaptable).filter(snaptable.updated == i[0]).first()
Expand Down
6 changes: 4 additions & 2 deletions webservice/SubmissionsPOMS.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,10 @@ def get_task_id_for(

if parent_submission_id is not None and parent_submission_id != "None":
s.recovery_tasks_parent = int(parent_submission_id)

self.poms_service.miscPOMS.snapshot_parts(ctx, s, s.campaign_stage_id)
keywords = None
if cs.campaign_obj and cs.campaign_obj.campaign_keywords:
keywords = cs.campaign_obj.campaign_keywords
self.poms_service.miscPOMS.snapshot_parts(ctx, s, s.campaign_stage_id, keywords)

ctx.db.add(s)
ctx.db.flush()
Expand Down