Bug 883214 - CPU speed filtering in hostRequires does not work when it's float value
Summary: CPU speed filtering in hostRequires does not work when it's float value
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Beaker
Classification: Retired
Component: scheduler
Version: 0.10
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: 0.11
Assignee: Qixiang Wan
QA Contact: Dan Callaghan
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-12-04 03:58 UTC by Qixiang Wan
Modified: 2018-02-06 00:41 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-01-17 04:34:20 UTC
Embargoed:


Attachments (Terms of Use)

Description Qixiang Wan 2012-12-04 03:58:21 UTC
Description of problem:

Typo in XmlCpuSpeed class (bkr.server.needpropertyxml):

value = self.get_xml_attr('value', int, None)

where 'int' should be float.

mysql> describe cpu speed;
+-------+-------+------+-----+---------+-------+
| Field | Type  | Null | Key | Default | Extra |
+-------+-------+------+-----+---------+-------+
| speed | float | YES  |     | NULL    |       |
+-------+-------+------+-----+---------+-------+

Traceback while using float value in cpu speed filtering:

Traceback (most recent call last):
  File "/root/devel/beaker/IntegrationTests/src/bkr/inttest/server/test_model.py", line 53, in test_cpu_speed
    """))
  File "/root/devel/beaker/Server/bkr/server/model.py", line 3056, in systems_filter
    systems = apply_system_filter(filter, systems)
  File "/root/devel/beaker/Server/bkr/server/needpropertyxml.py", line 907, in apply_system_filter
    (query, clause) = child.filter(query)
  File "/root/devel/beaker/Server/bkr/server/needpropertyxml.py", line 105, in filter
    (joins, query) = child.filter(joins)
  File "/root/devel/beaker/Server/bkr/server/needpropertyxml.py", line 667, in filter
    value = self.get_xml_attr('value', int, None)
  File "/root/devel/beaker/Server/bkr/server/needpropertyxml.py", line 81, in get_xml_attr
    return typeCast(attributes[attr])
ValueError: invalid literal for int() with base 10: '1500.0'



Version-Release number of selected component (if applicable):
beaker-0.10

How reproducible:
100%

Steps to Reproduce:
1. submit a job with float value of cpu speed in hostRequires, like
    <hostRequires>
        <cpu>
            <speed value="1500.0"/>
        </cpu>
    </hostRequires>


  
Actual results:

error message:

Failed to import job because of: "Error in hostRequires: invalid literal for int() with base 10: '1500.0'"

Expected results:
float value in cpu speed filtering should work.

Additional info:

Comment 1 Qixiang Wan 2012-12-04 04:05:20 UTC
patch post:

http://gerrit.beaker-project.org/1534

Comment 3 Dan Callaghan 2012-12-20 06:29:16 UTC
Verified that

			<hostRequires>
				<system_type value="Machine"/>
				<cpu>
					<speed op="&gt;=" value="1198.5"/>
				</cpu>
			</hostRequires>

includes a system with CPU speed 1199.0 and that

			<hostRequires>
				<system_type value="Machine"/>
				<cpu>
					<speed op="&gt;=" value="1199.5"/>
				</cpu>
			</hostRequires>

excludes it.

Comment 4 Dan Callaghan 2013-01-17 04:34:20 UTC
Beaker 0.11.0 has been released.


Note You need to log in before you can comment on or make changes to this bug.