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

🐛 Fix API logging #768

Merged
merged 2 commits into from
Sep 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
17 changes: 9 additions & 8 deletions creator/releases/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def start(self):
@transition(field=state, source="running", target="staged")
def staged(self):
""" The release has been staged """
return
logger.info(f"Release {self.pk} entered staged state")

@transition(field=state, source="staged", target="publishing")
def publish(self):
Expand All @@ -153,7 +153,7 @@ def complete(self):
else:
self.version = self.version.next_minor()
self.save()
return
logger.info(f"Release {self.pk} entered published state")

@transition(field=state, source=FAIL_SOURCES, target="canceling")
def cancel(self):
Expand All @@ -163,12 +163,12 @@ def cancel(self):
@transition(field=state, source="canceling", target="canceled")
def canceled(self):
""" The release has finished canceling """
return
logger.info(f"Release {self.pk} entered canceled state")

@transition(field=state, source=FAIL_SOURCES, target="failed")
def failed(self):
""" The release failed """
return
logger.info(f"Release {self.pk} entered failed state")


class ReleaseTask(models.Model):
Expand Down Expand Up @@ -305,7 +305,7 @@ def start(self):

@transition(field=state, source="running", target="staged")
def stage(self):
return
logger.info(f"Task {self.pk} entered staged state")

@transition(field=state, source="staged", target="publishing")
def publish(self):
Expand All @@ -326,15 +326,15 @@ def publish(self):

@transition(field=state, source="publishing", target="published")
def complete(self):
return
logger.info(f"Task {self.pk} entered published state")

@transition(field=state, source="waiting", target="rejected")
def reject(self):
return
logger.info(f"Task {self.pk} entered rejected state")

@transition(field=state, source="*", target="failed")
def failed(self):
return
logger.info(f"Task {self.pk} entered failed state")

@transition(field=state, source="*", target="canceled")
def cancel(self):
Expand All @@ -352,6 +352,7 @@ def cancel(self):
)
logger.error(error)
raise ValueError(error)
logger.info(f"Task {self.pk} entered canceled state")

def check_state(self):
"""
Expand Down
17 changes: 3 additions & 14 deletions creator/settings/development.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,24 +254,13 @@
},
},
"loggers": {
"TaskLogger": {},
"creator.management": {"handlers": ["command"], "level": "INFO"},
"rq.worker": {"handlers": ["rq_console"], "level": "ERROR"},
"creator.tasks": {"handlers": ["task"], "level": "INFO"},
"creator.slack": {"handlers": ["task"], "level": "INFO"},
"creator.studies.dataservice": {"handlers": ["task"], "level": "INFO"},
"creator.studies.buckets": {"handlers": ["task"], "level": "INFO"},
"creator.studies.schema": {"handlers": ["task"], "level": "INFO"},
"TaskLogger": {"handlers": ["task"], "level": "INFO"},
"creator": {"handlers": ["task"], "level": "INFO"},
"creator.ingest_runs.genomic_data_loader": {
"handlers": ["task"],
"level": "DEBUG",
},
"creator.ingest_runs.tasks.validation_run": {
"handlers": ["task"],
"level": "INFO",
},
"creator.data_templates.mutations.template_version": {
"handlers": ["task"], "level": "INFO"
"propagate": False,
},
},
}
Expand Down
20 changes: 4 additions & 16 deletions creator/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,29 +295,17 @@ def traces_sampler(sampling_context):
},
},
"loggers": {
"TaskLogger": {"handlers": ["task"], "level": "INFO"},
"rq.worker": {"handlers": ["rq_console"]},
"graphql.execution.utils": {
"handlers": ["command"],
"level": "CRITICAL",
},
"creator": {"handlers": ["task"]},
"creator.management": {"handlers": ["command"], "level": "INFO"},
"rq.worker": {"handlers": ["rq_console"]},
"creator.decorators": {"handlers": ["task"]},
"TaskLogger": {"handlers": ["task"], "level": "INFO"},
"creator": {"handlers": ["task"], "level": "INFO"},
"creator.ingest_runs.genomic_data_loader": {
"handlers": ["task"],
"level": "DEBUG",
},
"creator.ingest_runs.tasks.validation_run": {
"handlers": ["task"],
"level": "INFO",
},
"creator.data_templates.mutations.template_version": {
"handlers": ["task"], "level": "ERROR"
},
"creator.releases.tasks": {
"handlers": ["task"],
"level": "INFO",
"propagate": False,
},
},
}
Expand Down
19 changes: 5 additions & 14 deletions creator/settings/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,22 +252,13 @@
},
},
"loggers": {
"TaskLogger": {},
"creator.management": {"handlers": ["command"], "level": "INFO"},
"rq.worker": {"handlers": ["rq_console"], "level": "ERROR"},
"creator.tasks": {"handlers": ["task"], "level": "INFO"},
"creator.slack": {"handlers": ["task"], "level": "INFO"},
"creator.studies.dataservice": {"handlers": ["task"], "level": "INFO"},
"creator.studies.buckets": {"handlers": ["task"], "level": "INFO"},
"creator.studies.schema": {"handlers": ["task"], "level": "INFO"},
"TaskLogger": {"handlers": ["task"], "level": "INFO"},
"creator": {"handlers": ["task"], "level": "INFO"},
"creator.ingest_runs.genomic_data_loader": {
"handlers": ["task"], "level": "DEBUG"
},
"creator.ingest_runs.tasks.validation_run": {
"handlers": ["task"], "level": "INFO"
},
"creator.data_templates.mutations.template_version": {
"handlers": ["task"], "level": "INFO"
"handlers": ["task"],
"level": "DEBUG",
"propagate": False,
},
},
}
Expand Down