Skip to content

Commit

Permalink
fixes npe issue with --stats
Browse files Browse the repository at this point in the history
  • Loading branch information
munishchouhan committed Sep 30, 2024
1 parent 0c1ac90 commit bf77e72
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/io/seqera/tower/cli/commands/runs/ViewCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import io.seqera.tower.model.Workflow;
import io.seqera.tower.model.WorkflowLoad;
import io.seqera.tower.model.WorkflowQueryAttribute;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import picocli.CommandLine;

import java.util.ArrayList;
Expand All @@ -56,6 +58,7 @@
)
public class ViewCmd extends AbstractRunsCmd {

private static final Logger log = LoggerFactory.getLogger(ViewCmd.class);
@CommandLine.Option(names = {"-i", "--id"}, description = "Pipeline run identifier.", required = true)
public String id;

Expand Down Expand Up @@ -144,7 +147,8 @@ protected Response exec() throws ApiException {

Map<String, Object> stats = new HashMap<>();
if (opts.stats) {
stats.put("wallTime", TimeUnit.MILLISECONDS.toSeconds(workflow.getDuration()) / 60D);
if( workflow.getDuration() != null )
stats.put("wallTime", TimeUnit.MILLISECONDS.toSeconds(workflow.getDuration()) / 60D);
if(progress.getWorkflowProgress() != null) {
stats.put("cpuTime", TimeUnit.MILLISECONDS.toMinutes(progress.getWorkflowProgress().getCpuTime()) / 60D);
stats.put("totalMemory", progress.getWorkflowProgress().getMemoryRss() / 1024 / 1024 / 1024D);
Expand Down

0 comments on commit bf77e72

Please sign in to comment.