blib/lib/HPC/Runner/Node.pm untested

filter: Statementstmt 0.0% 0 / 41 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 52 CC 2 SCAR 10.6
CC
2
Cov
0%
go
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.9
1 package HPC::Runner::Node;
2  
3 use Moose;
4 use IO::File;
5 use IO::Select;
6 use IPC::Open3;
7 use Symbol;
8 use IPC::Cmd qw[can_run run];
9  
10 extends 'HPC::Runner::Slurm';
11  
12 use Data::Dumper;
13  
14 =head2 infile
15 turn this off, just testing the nodes
16 =cut
17  
18 has '+infile' => (
19 required => 0,
20 );
21  
22 has 'all' => (
23 is => 'rw',
24 traits => ['Bool'],
25 default => 0,
26 isa => 'Bool',
27 );
28  
29 =head2 go
30 Start doing the node check
31 =cut
32 sub go {
33 my $self = shift;
34
35 $self->get_nodes;
36  
37 # my $node = $self->nodelist->[0];
38 foreach my $node (@{$self->nodelist}) {
39  
40 my $cmd = "srun --partition ".$self->partition." --nodelist ".$node." /home/guests/jir2004/perlmodule/HPC-Runner-Slurm/script/cpus.pl ";
41  
42 print "\n========================================================\n";
43 print "$cmd\n";
44  
45 print "Report Node: ".$node."Partition: ".$self->partition."\n";
46 print "========================================================\n\n";
47  
48  
49 ### in list context ###
50 my( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
51 run( command => $cmd, verbose => 0, timeout => 100 );
52  
53 if( $success ) {
54 print "this is what the command printed:\n";
55 print join "", @$full_buf;
56 }
57 else{
58 print "Command was not successful.\n";
59 print "Error Code: $error_code\n";
60 print join(" ", @$full_buf)."\n";
61 }
62  
63 }
64 }
65  
66  
67 1;