Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Remove experimental shredder feature #57

Merged
merged 1 commit into from
Feb 17, 2017
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
24 changes: 0 additions & 24 deletions classes/OpenXdmod/Shredder.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,30 +292,6 @@ public function hasResource()
return isset($this->resource);
}

/**
* Return the resource node name for a node name.
*
* @param string $node
* @param string $date
* @param string $fallback
*
* @return string
*/
public function getResourceForNode($node, $date, $fallback = null)
{
$this->logger->debug("Getting resource name for node '$node'");

if ($this->hasResource()) {
return $this->getResource();
}

if ($fallback === null) {
throw new Exception("Failed to find resource for node '$node'");
}

return $fallback;
}

/**
* Set the column used to determine the PI.
*
Expand Down
6 changes: 1 addition & 5 deletions classes/OpenXdmod/Shredder/Pbs.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,7 @@ public function shredLine($line)
return;
}

$job['host'] = $this->getResourceForNode(
$node,
$date,
$jobIdData['host']
);
$job['host'] = $this->getResource();

foreach (array_keys($job) as $key) {
if (!in_array($key, self::$columnNames)) {
Expand Down
7 changes: 1 addition & 6 deletions classes/OpenXdmod/Shredder/Sge.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,12 +353,7 @@ public function shredLine($line)

$this->checkJobData($line, $job);

$date = DateTime::createFromFormat('U', $job['end_time']);

$job['clustername'] = $this->getResourceForNode(
$job['hostname'],
$date->format('Y-m-d')
);
$job['clustername'] = $this->getResource();

$this->insertRow($job);
}
Expand Down
8 changes: 1 addition & 7 deletions classes/OpenXdmod/Shredder/Slurm.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,6 @@ public function shredLine($line)
return;
}

$date = substr($job['end_time'], 0, 10);

// Convert datetime strings into unix timestamps.
$dateKeys = array(
'submit_time',
Expand All @@ -250,11 +248,7 @@ public function shredLine($line)
$job[$key] = $this->parseTimeField($job[$key]);
}

$job['cluster_name'] = $this->getResourceForNode(
$node,
$date,
$job['cluster_name']
);
$job['cluster_name'] = $this->getResource();

$this->checkJobData($line, $job);

Expand Down
7 changes: 0 additions & 7 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,6 @@ principal investigator (`pi`), center staff (`cs`) and manager (`mgr`).
}
}

### node_attributes.json

Used to define data needed for sub-resources.

**NOTE**: This configuration file is deprecated and may be removed in
a future release.

### organization.json

Defines the organization name and abbreviation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,22 @@ public function testShredder($line, $row)
$shredder = $this
->getMockBuilder('\OpenXdmod\Shredder\Lsf')
->disableOriginalConstructor()
->setMethods(array('insertRow'))
->setMethods(array('insertRow', 'getResourceConfig'))
->getMock();

$shredder
->expects($this->once())
->method('insertRow')
->with($row);

$shredder
->method('getResourceConfig')
->willReturn(array());

$shredder->setLogger(\Log::singleton('null'));

$shredder->setResource('testresource');

$shredder->shredLine($line);
}

Expand Down Expand Up @@ -202,7 +208,7 @@ public function accountingLogProvider()
'unknown61' => '1',
'unknown62' => '',
'walltime' => 5794523.29,
'resource_name' => null,
'resource_name' => 'testresource',
'node_list' => 'host1201-ib,host1234-ib,host1235-ib,host1236-ib,host1257-ib,host1270-ib,host1301-ib,host1303-ib',
)
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,22 @@ public function testShredderParsing($line, $row)
$shredder = $this
->getMockBuilder('\OpenXdmod\Shredder\Pbs')
->disableOriginalConstructor()
->setMethods(array('insertRow'))
->setMethods(array('insertRow', 'getResourceConfig'))
->getMock();

$shredder
->expects($this->once())
->method('insertRow')
->with($row);

$shredder
->method('getResourceConfig')
->willReturn(array());

$shredder->setLogger(\Log::singleton('null'));

$shredder->setResource('testresource');

$shredder->shredLine($line);
}

Expand All @@ -57,7 +63,7 @@ public function accountingLogProvider()
'12/21/2009 15:27:00;E;6.edge.ccr.buffalo.edu;user=jonesm group=ccrstaff jobname=impi-hybrid queue=ccr ctime=1261424924 qtime=1261424924 etime=1261424924 start=1261425023 owner=jonesm@edge.ccr.buffalo.edu exec_host=i02n33/7+i02n33/6+i02n33/5+i02n33/4+i02n33/3+i02n33/2+i02n33/1+i02n33/0+i02n32/7+i02n32/6+i02n32/5+i02n32/4+i02n32/3+i02n32/2+i02n32/1+i02n32/0+i02n31/7+i02n31/6+i02n31/5+i02n31/4+i02n31/3+i02n31/2+i02n31/1+i02n31/0+i02n30/7+i02n30/6+i02n30/5+i02n30/4+i02n30/3+i02n30/2+i02n30/1+i02n30/0 Resource_List.neednodes=4:ppn=8 Resource_List.nodect=4 Resource_List.nodes=4:ppn=8 Resource_List.pcput=144:00:00 Resource_List.walltime=04:00:00 session=5510 end=1261427220 Exit_status=0 resources_used.cput=00:00:00 resources_used.mem=15240kb resources_used.vmem=350936kb resources_used.walltime=00:36:37',
array(
'job_id' => '6',
'host' => 'edge.ccr.buffalo.edu',
'host' => 'testresource',
'queue' => 'ccr',
'user' => 'jonesm',
'groupname' => 'ccrstaff',
Expand Down Expand Up @@ -90,7 +96,7 @@ public function accountingLogProvider()
'11/09/2014 23:59:51;E;6464684.anonhost;user=anonuser group=anongroup jobname=anonjob queue=default ctime=1415579756 qtime=1415579756 etime=1415579756 start=1415589841 owner=anon@n180 exec_host=n404/2+n404/3+n404/4+n404/5 Resource_List.mem=1993mb Resource_List.ncpus=1 Resource_List.neednodes=1:ppn=4:avx Resource_List.nodect=1 Resource_List.nodes=1:ppn=4:avx Resource_List.walltime=24:00:00 session=100966 end=1415599191 Exit_status=1 resources_used.cput=10:16:36 resources_used.mem=167864kb resources_used.vmem=622552kb resources_used.walltime=02:35:49 account=anonaccount',
array(
'job_id' => '6464684',
'host' => 'anonhost',
'host' => 'testresource',
'queue' => 'default',
'user' => 'anonuser',
'groupname' => 'anongroup',
Expand Down Expand Up @@ -125,7 +131,7 @@ public function accountingLogProvider()
'01/26/2016 00:00:37;E;2994.pbs;user=anonuser group=anongroup project=_pbs_project_default jobname=anonjob queue=workq ctime=1453756297 qtime=1453756297 etime=1453756297 start=1453766281 exec_host=c1/0*13+c2/0*13+c3/0*13+c4/0*13+c5/0*13 exec_vnode=(c1:ncpus=13)+(c2:ncpus=13)+(c3:ncpus=13)+(c4:ncpus=13)+(c5:ncpus=13) Resource_List.ncpus=65 Resource_List.nodect=5 Resource_List.place=scatter:excl Resource_List.select=5:ncpus=13 Resource_List.walltime=00:02:43 session=17927 end=1453766437 Exit_status=0 resources_used.cpupercent=0 resources_used.cput=00:00:00 resources_used.mem=664kb resources_used.ncpus=65 resources_used.vmem=10704kb resources_used.walltime=00:00:00 run_count=1',
array(
'job_id' => '2994',
'host' => 'pbs',
'host' => 'testresource',
'queue' => 'workq',
'user' => 'anonuser',
'groupname' => 'anongroup',
Expand Down Expand Up @@ -154,7 +160,7 @@ public function accountingLogProvider()
'01/26/2016 00:00:37;E;2995.pbs;user=anonuser group=anongroup project=_pbs_project_default jobname=anonjob queue=anonq ctime=1453756297 qtime=1453756297 etime=1453756297 start=1453766281 exec_host=c1/0-3+c2/0-7 Resource_List.ncpus=12 Resource_List.nodect=2 Resource_List.walltime=00:02:43 session=17927 end=1453766437 Exit_status=0 resources_used.cput=00:00:00 resources_used.mem=664kb resources_used.ncpus=12 resources_used.vmem=10704kb resources_used.walltime=00:00:00 run_count=1',
array(
'job_id' => '2995',
'host' => 'pbs',
'host' => 'testresource',
'queue' => 'anonq',
'user' => 'anonuser',
'groupname' => 'anongroup',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,22 @@ public function testShredderParsing($line, $row)
$shredder = $this
->getMockBuilder('\OpenXdmod\Shredder\Sge')
->disableOriginalConstructor()
->setMethods(array('insertRow', 'hasResource'))
->setMethods(array('insertRow', 'getResourceConfig'))
->getMock();

$shredder
->method('hasResource')
->willReturn(true);

$shredder
->expects($this->once())
->method('insertRow')
->with($row);

$shredder
->method('getResourceConfig')
->willReturn(array());

$shredder->setLogger(\Log::singleton('null'));

$shredder->setResource('testresource');

$shredder->shredLine($line);
}

Expand Down Expand Up @@ -114,7 +116,7 @@ public function accountingLogProvider()
'resource_list_s_cpu' => '36000',
'resource_list_s_rt' => '36000',
'resource_list_slots' => '1',
'clustername' => null,
'clustername' => 'testresource',
),
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,22 @@ public function testShredderParsing($line, $row)
$shredder = $this
->getMockBuilder('\OpenXdmod\Shredder\Slurm')
->setConstructorArgs(array($this->db))
->setMethods(array('insertRow'))
->setMethods(array('insertRow', 'getResourceConfig'))
->getMock();

$shredder
->expects($this->once())
->method('insertRow')
->with($row);

$shredder
->method('getResourceConfig')
->willReturn(array());

$shredder->setLogger(\Log::singleton('null'));

$shredder->setResource('testresource');

$shredder->shredLine($line);
}

Expand Down Expand Up @@ -91,7 +97,7 @@ public function accountingLogProvider()
'job_id' => '4103947',
'job_id_raw' => '4103947',
'job_array_index' => -1,
'cluster_name' => 'ub-hpc',
'cluster_name' => 'testresource',
'partition_name' => 'general-compute',
'account_name' => 'anon',
'group_name' => 'anon',
Expand Down Expand Up @@ -122,7 +128,7 @@ public function accountingLogProvider()
'job_id' => '4107166',
'job_id_raw' => '4107166',
'job_array_index' => -1,
'cluster_name' => 'ub-hpc',
'cluster_name' => 'testresource',
'partition_name' => 'general-compute',
'account_name' => 'dspumpkins',
'group_name' => 'dspumpkins',
Expand Down Expand Up @@ -153,7 +159,7 @@ public function accountingLogProvider()
'job_id' => '4107219',
'job_id_raw' => '4107219',
'job_array_index' => -1,
'cluster_name' => 'ub-hpc',
'cluster_name' => 'testresource',
'partition_name' => 'general-compute',
'account_name' => 'anonacct',
'group_name' => 'anongroup',
Expand Down Expand Up @@ -184,7 +190,7 @@ public function accountingLogProvider()
'job_id' => '5692623',
'job_id_raw' => '5692623',
'job_array_index' => -1,
'cluster_name' => 'ub-hpc',
'cluster_name' => 'testresource',
'partition_name' => '',
'account_name' => 'ccr',
'group_name' => 'na',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,22 @@ public function testShredderParsing($line, $row)
$shredder = $this
->getMockBuilder('\OpenXdmod\Shredder\Uge')
->disableOriginalConstructor()
->setMethods(array('insertRow', 'hasResource'))
->setMethods(array('insertRow', 'getResourceConfig'))
->getMock();

$shredder
->method('hasResource')
->willReturn(true);

$shredder
->expects($this->once())
->method('insertRow')
->with($row);

$shredder
->method('getResourceConfig')
->willReturn(array());

$shredder->setLogger(\Log::singleton('null'));

$shredder->setResource('testresource');

$shredder->shredLine($line);
}

Expand Down Expand Up @@ -115,7 +117,7 @@ public function accountingLogProvider()
'resource_list_s_cpu' => '36000',
'resource_list_s_rt' => '36000',
'resource_list_slots' => '1',
'clustername' => null,
'clustername' => 'testresource',
),
),
);
Expand Down