update log messages to ease debugging (#988)

This commit is contained in:
bmc-msft
2021-06-14 15:18:03 -04:00
committed by GitHub
parent 4472d584ac
commit b9950c5526
5 changed files with 16 additions and 7 deletions

View File

@ -173,7 +173,8 @@ def on_worker_event_running(
if task.state in TaskState.shutting_down():
logging.info(
"ignoring task start from node. machine_id:%s %s:%s (state: %s)",
"ignoring task start from node. "
"machine_id:%s job_id:%s task_id:%s (state: %s)",
machine_id,
task.job_id,
task.task_id,
@ -182,7 +183,7 @@ def on_worker_event_running(
return None
logging.info(
"task started on node. machine_id:%s %s:%s",
"task started on node. machine_id:%s job_id%s task_id:%s",
machine_id,
task.job_id,
task.task_id,

View File

@ -236,7 +236,9 @@ class Task(BASE_TASK, ORMMixin):
task.mark_failed(
Error(
code=ErrorCode.TASK_FAILED,
errors=["prerequisite task failed"],
errors=[
"prerequisite task failed. task_id:%s" % self.task_id
],
),
tasks_in_job,
)

View File

@ -232,7 +232,10 @@ class Node(BASE_NODE, ORMMixin):
if error is None:
error = Error(
code=ErrorCode.TASK_FAILED,
errors=["node reimaged during task execution"],
errors=[
"node reimaged during task execution. machine_id:%s"
% self.machine_id
],
)
for entry in NodeTasks.get_by_machine_id(self.machine_id):

View File

@ -18,12 +18,14 @@ from ..onefuzzlib.tasks.scheduler import schedule_tasks
def main(mytimer: func.TimerRequest, dashboard: func.Out[str]) -> None: # noqa: F841
expired_tasks = Task.search_expired()
for task in expired_tasks:
logging.info("stopping expired task: %s", task.job_id)
logging.info(
"stopping expired task. job_id:%s task_id:%s", task.job_id, task.task_id
)
task.mark_stopping()
expired_jobs = Job.search_expired()
for job in expired_jobs:
logging.info("stopping expired job: %s", job.job_id)
logging.info("stopping expired job. job_id:%s", job.job_id)
job.stopping()
jobs = Job.search_states(states=JobState.needs_work())

View File

@ -346,10 +346,11 @@ class TestOnefuzz:
# check if the task itself has an error
if task.error is not None:
self.logger.error(
"task failed: %s - %s (%s)",
"task failed: %s - %s (%s) - %s",
job.config.name,
task.config.task.type.name,
task.error,
task.task_id,
)
return TaskTestState.failed