Skip to content

Commit

Permalink
Display the current_step in the run status tag #300
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Druez <tdruez@nexb.com>
  • Loading branch information
tdruez committed Jul 25, 2022
1 parent 1329f8e commit a1aa87c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion scanpipe/pipelines/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def execute(self):
step_name = step.__name__

# The `current_step` value is saved in the DB during the `self.log` call.
self.run.current_step = f"[{current_index}/{steps_count}] {step_name}"
self.run.current_step = f"{current_index}/{steps_count} {step_name}"
self.log(f"Step [{step_name}] starting")
start_time = timeit.default_timer()

Expand All @@ -127,6 +127,7 @@ def execute(self):
run_time = timeit.default_timer() - start_time
self.log(f"Step [{step.__name__}] completed in {run_time:.2f} seconds")

self.run.current_step = ""
self.log(f"Pipeline completed")

return 0, ""
Expand Down
2 changes: 1 addition & 1 deletion scanpipe/templates/scanpipe/includes/project_inputs.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Inputs
</p>
{% for input in inputs_with_source %}
<div class="panel-block is-flex is-justify-content-space-between dropdown is-hoverable is-up is-cursor-help">
<div class="panel-block is-justify-content-space-between dropdown is-hoverable is-up is-cursor-help">
<div class="break-all pr-1">
<div class="panel-icon pt-1">
<div class="dropdown-trigger">
Expand Down
4 changes: 2 additions & 2 deletions scanpipe/templates/scanpipe/includes/project_pipelines.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
Pipelines
</p>
{% for run in project.runs.all %}
<a class="panel-block modal-button is-flex is-justify-content-space-between" data-target="run-detail-modal" data-uuid="{{ run.uuid }}" aria-haspopup="true">
<a class="panel-block modal-button is-justify-content-space-between" data-target="run-detail-modal" data-uuid="{{ run.uuid }}" aria-haspopup="true">
<span class="mr-1">{{ run.pipeline_name }}</span>
{% include "scanpipe/includes/run_status_tag.html" with run=run only %}
{% include "scanpipe/includes/run_status_tag.html" with run=run display_current_step=True only %}
</a>
{% endfor %}
<div class="panel-block">
Expand Down
7 changes: 5 additions & 2 deletions scanpipe/templates/scanpipe/includes/run_status_tag.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{% if run.status == run.Status.RUNNING or run.status == run.Status.QUEUED %}
<span class="tag is-info" hx-get="{% url 'run_status' run.uuid %}?current_status={{ run.status }}" hx-trigger="load delay:10s" hx-swap="outerHTML">
{% if run.status == run.Status.RUNNING %}
Running <i class="fas fa-spinner fa-pulse ml-1" aria-hidden="true"></i>
<i class="fas fa-spinner fa-pulse mr-1" aria-hidden="true"></i>Running
{% if display_current_step and run.current_step %}
{{ run.current_step|truncatechars:30 }}
{% endif %}
{% elif run.status == run.Status.QUEUED %}
Queued <i class="fas fa-clock ml-1"></i>
<i class="fas fa-clock mr-1"></i>Queued
{% endif %}
</span>
{% elif run.status == run.Status.SUCCESS %}
Expand Down

0 comments on commit a1aa87c

Please # to comment.