Skip to content

Commit

Permalink
process towards task automatation for CSH
Browse files Browse the repository at this point in the history
first sample task almost running
  • Loading branch information
Tom Gebhardt authored and Tom Gebhardt committed Oct 26, 2023
1 parent 0368ef1 commit 3715c83
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 2 additions & 0 deletions app/celery/automated_tasks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from .f1_model_persistent_identifier_task import f1_model_persistent_identifier
from .f4_model_metadata_harvestable_task import f4_model_metadata_harvestable
from .csh_f2_persistent_identifier_task import csh_f2_persistent_identifier

__all__ = [
f1_model_persistent_identifier,
f4_model_metadata_harvestable,
csh_f2_persistent_identifier
]
13 changes: 11 additions & 2 deletions app/models/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,13 @@ def __init__(self, session: Session) -> None:
self.assessed_data: Optional["CombineArchive"] = None

if not session.tasks:
if self.user_input.subject_type not in [SubjectType.manual, SubjectType.csh]:
if self.user_input.subject_type in [SubjectType.file, SubjectType.url]: #url is currently not supported, thus this step wouldn't be reached for URL support
self.assessed_data = self.retrieve_data(self.user_input.path)
elif self.user_input.subject_type is SubjectType.csh:
print("---")
print(self.user_input)
print("---")
self.assessed_data = self.user_input.metadata
self.create_tasks()

else:
Expand Down Expand Up @@ -583,7 +588,11 @@ def start_automated_tasks(self):
task = self.session_model.get_task(task_id)
print(task)
if isinstance(task, AutomatedTask):
task.do_evaluate(self.assessed_data.dict())
if self.user_input.subject_type is not SubjectType.csh:
task.do_evaluate(self.assessed_data.dict())
else:
print("???????????????")
task.do_evaluate(self.assessed_data)

def json(self):
"""Returns the json representation of the session model"""
Expand Down
4 changes: 1 addition & 3 deletions app/routers/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,12 @@ def create_session(
finally:
uploaded_file.file.close()
elif subject.subject_type is SubjectType.csh:
print(subject)
print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!! SUBJECT TYPE CSH DETECTED!")
if subject.metadata is None:
raise HTTPException(
422, "No JSON object was attached for assessment. Impossible to process query"
)
try:
session_handler = SessionHandler.from_user_input(session_id, subject) #is the only for form input? My impression: i
session_handler = SessionHandler.from_user_input(session_id, subject)
except ValueError as e:
raise HTTPException(422, str(e))
try:
Expand Down

0 comments on commit 3715c83

Please sign in to comment.