Skip to content

Commit 3bb49f2

Browse files
authored
Fix IOPub error when showing progress with get_raw_data(). (#40)
1 parent 4b62d53 commit 3bb49f2

File tree

9 files changed

+67
-65
lines changed

9 files changed

+67
-65
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
<!--- Go over all the following points and make sure they have all been completed -->
2828
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
2929
- [ ] `CHANGELOG.md` has been updated
30+
- [ ] `xdmod_data/__version__.py` has been updated to the next development version
3031
- [ ] The milestone is set correctly on the pull request
3132
- [ ] The appropriate labels have been added to the pull request
3233
- [ ] Running the automated tests (see `docs/developing.md`) produces no errors
3334
- [ ] Updates have been made to the `xdmod-notebooks` repository as necessary, and the notebooks all run successfully
35+
- [ ] The changes in this PR have been ported/backported to other branches as needed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# xdmod-data Changelog
22

3-
## Main development branch
3+
## v1.x.y development branch
44

55
- Document Open XDMoD compatibility in changelog ([\#31](https://github.com/ubccr/xdmod-data/pull/31)).
6+
- Fix IOPub error when showing progress with `get_raw_data()` ([\#37](https://github.com/ubccr/xdmod-data/pull/37)).
67

78
## v1.0.1 (2024-09-27)
89

docs/developing.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@
9090
1. Go to the [GitHub milestones](https://github.com/ubccr/xdmod-data/milestones) and close the milestone for the version.
9191
9292
## After release
93-
9493
1. Make a new branch of `xdmod-data` and:
9594
1. Make sure the version number is updated in `xdmod_data/__version__.py` to a pre-release of the next version, e.g., `1.0.1-01`.
9695
1. Update `CHANGELOG.md` to add a section at the top called `Main development branch`.

tests/regression/data/jobs-dimensions.csv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ id,label,description
22
none,None,Summarizes jobs reported to the ACCESS allocations service (excludes non-ACCESS usage of the resource).
33
allocation,Allocation,A funded project that is allowed to run jobs on resources.
44
fieldofscience,Field of Science,The field of science indicated on the allocation request pertaining to the running jobs.
5-
gateway,Gateway,A science gateway is a portal set up to aid submiting jobs to resources.
5+
gateway,Gateway,A science gateway is a portal set up to aid submitting jobs to resources.
66
grant_type,Grant Type,A categorization of the projects/allocations.
77
jobsize,Job Size,A categorization of jobs into discrete groups based on the number of cores used by each job.
88
jobwaittime,Job Wait Time,A categorization of jobs into discrete groups based on the total linear time each job waited.
@@ -19,7 +19,7 @@ resource,Resource,A resource is a remote computer that can run jobs.
1919
resource_type,Resource Type,A categorization of resources into by their general capabilities.
2020
provider,Service Provider,A service provider is an institution that hosts resources.
2121
username,System Username,The specific system username of the users who ran jobs.
22-
person,User,"A person who is on a PIs allocation, hence able run jobs on resources."
22+
person,User,"A person who is on a PIs allocation, hence able to run jobs on resources."
2323
institution,User Institution,Organizations that have users with allocations.
2424
institution_country,User Institution Country,The name of the country of the institution of the person who ran the compute job.
2525
institution_state,User Institution State,The location of the institution of the person who ran the compute job.

tests/regression/data/jobs-metrics.csv

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
id,label,description
2+
utilization,ACCESS CPU Utilization (%),"The percentage of the ACCESS obligation of a resource that has been utilized by ACCESS jobs.<br/><i> ACCESS CPU Utilization:</i> The ratio of the total CPU hours consumed by ACCESS jobs over a given time period divided by the total CPU hours that the system is contractually required to provide to ACCESS during that period. It does not include non-ACCESS jobs.<br/>It is worth noting that this value is a rough estimate in certain cases where the resource providers don't provide accurate records of their system specifications, over time."
23
avg_ace,ACCESS Credit Equivalents Charged: Per Job (SU),"The average amount of ACCESS Credit Equivalents charged per compute job.<br/>
34

45
The ACCESS Credit Equivalent is a measure of how much compute time was used on each resource.
@@ -15,7 +16,6 @@ The ACCESS Credit Equivalent allows comparison between usage of node-allocated,
1516
resources. It also allows a comparison between resources with different compute power per core.
1617
The <a href=""https://allocations.access-ci.org/exchange_calculator"" target=""_blank"" rel=""noopener noreferrer"">ACCESS allocations exchange calculator</a>
1718
lists conversion rates between an ACCESS Credit Equivalent and a service unit on a resource."
18-
utilization,ACCESS Utilization (%),"The percentage of the ACCESS obligation of a resource that has been utilized by ACCESS jobs.<br/><i> ACCESS Utilization:</i> The ratio of the total CPU hours consumed by ACCESS jobs over a given time period divided by the total CPU hours that the system is contractually required to provide to ACCESS during that period. It does not include non-ACCESS jobs.<br/>It is worth noting that this value is a rough estimate in certain cases where the resource providers don't provide accurate records of their system specifications, over time."
1919
rate_of_usage,Allocation Usage Rate (XD SU/Hour),The rate of ACCESS allocation usage in XD SUs per hour.
2020
rate_of_usage_ace,Allocation Usage Rate ACEs (SU/Hour),The rate of ACCESS allocation usage in ACCESS Credit Equivalents per hour.
2121
avg_cpu_hours,CPU Hours: Per Job,"The average CPU hours (number of CPU cores x wall time hours) per ACCESS job.<br/>For each job, the CPU usage is aggregated. For example, if a job used 1000 CPUs for one minute, it would be aggregated as 1000 CPU minutes or 16.67 CPU hours."
@@ -82,7 +82,7 @@ Current TeraGrid supercomputers have complex multi-core and memory hierarchies.
8282

8383
Note: The actual charge will depend on the specific requirements of the job (e.g., the mapping of the cores across the machine, or the priority you wish to obtain).<br/>
8484

85-
Note 2: The SUs show here have been normalized against the XSEDE Roaming service. Therefore they are comparable across resources."
85+
Note 2: The SUs shown here have been normalized against the XSEDE Roaming service. Therefore they are comparable across resources."
8686
total_su,XD SUs Charged: Total,"The total amount of XD SUs charged by ACCESS jobs.<br/>
8787
<i>XD SU: </i>1 XSEDE SU is defined as one CPU-hour on a Phase-1 DTF cluster.<br/>
8888
<i>SU - Service Units: </i>Computational resources on the XSEDE are allocated and charged in service units (SUs). SUs are defined locally on each system, with conversion factors among systems based on HPL benchmark results.<br/>
@@ -91,4 +91,4 @@ Current TeraGrid supercomputers have complex multi-core and memory hierarchies.
9191

9292
Note: The actual charge will depend on the specific requirements of the job (e.g., the mapping of the cores across the machine, or the priority you wish to obtain).<br/>
9393

94-
Note 2: The SUs show here have been normalized against the XSEDE Roaming service. Therefore they are comparable across resources."
94+
Note 2: The SUs shown here have been normalized against the XSEDE Roaming service. Therefore they are comparable across resources."
Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
11
,Nodes,Requested Wall Time,Wait Time,Wall Time,CPU User,"Mount point ""home"" data written","Mount point ""scratch"" data written",Total memory used
2-
0,1,172800,11,506,,,,
3-
1000,1,86400,1,66,,,,
4-
2000,1,86400,18,752,,,,
5-
3000,1,86400,8,5434,,,,
6-
4000,1,86400,6,1572,,,,
7-
5000,1,172800,7,2592,,,,
8-
6000,1,14400,7,2800,,,,
9-
7000,1,3600,2894,1357,,,,
10-
8000,1,21600,116,7277,,,,
11-
9000,1,21600,2173,6764,,,,
12-
10000,1,21600,3574,7095,,,,
13-
11000,1,9000,4,3564,88.01518903173182,992.4354304606816,267087841.6178405,811231171.4285715
14-
12000,1,21600,158,5565,,,,
15-
13000,1,21600,59,6965,,,,
16-
14000,1,21600,9,7760,,,,
17-
15000,1,3600,22122,1335,,,,
18-
16000,1,28800,130,9421,12.262731018331898,19749.432156075072,0,787292327.46875
19-
17000,1,28800,6,1990,,,,
20-
18000,1,172800,13,73,,,,
21-
19000,1,172800,7,129,,,,
22-
20000,1,25200,4,25211,82.16279473845965,0,5113844.667942916,240912572.72941175
23-
21000,1,21600,18,6099,,,,
24-
22000,1,21600,27,7131,,,,
25-
23000,1,1800,61,1079,35.02319701051263,5818814744.200479,0,91742777.25
26-
24000,1,3600,5,2306,0.11814596015380158,,,33983854837.760006
27-
25000,1,960,1,59,2.025062333453586,0,0,118141168
28-
26000,1,172800,1,20494,87.54061396105656,548.1123048956289,0,224020798.15942028
29-
27000,4,7200,2,7214,99.2396948622311,441.0514348202534,34392345950.27519,1104895888.4
30-
28000,1,21600,13,55,1.2148444482641405,,,
31-
29000,1,21600,171,40,,,,
32-
30000,1,960,0,42,1.5504320217730077,0,0,112133180
33-
31000,1,1800,11,183,25.94758412119134,,,129784697856
34-
32000,1,21600,372,114,1.5571541609296509,,,92681043968
35-
33000,2,1800,134,139,55.875186246345784,533.6963000565588,754284385.8435647,137041136
36-
34000,1,7200,74,9,0.94096807333301,4681.666820975073,0,145688575
37-
35000,1,172800,22,83953,98.95217460976379,,,91787361316.73543
38-
36000,1,6000,8,152,0.4601673251104144,,,85277047466.66667
39-
37000,1,900,124,137,96.18834348033303,,,35703571797.333336
40-
38000,1,21600,12,56,24.892228849477622,,,
41-
39000,1,21600,12,134,26.487756894710913,,,113801609216
42-
40000,1,21600,12,229,45.74138522053433,,,42761861802.66667
43-
41000,1,21600,20,307,0.9428384414161763,,,27184930360.88889
44-
42000,1,21600,130,386,1.68608777466353,,,49510031732.36363
2+
0,1,172800,2,15048,67.78143277322484,0,0,149919987.98039216
3+
1000,1,1800,7,133,,,,
4+
2000,1,86400,8,1997,,,,
5+
3000,2,60,7,10,,,,
6+
4000,1,172800,448,88,,,,
7+
5000,1,72000,1514,5277,,,,
8+
6000,1,3600,5575,1340,,,,
9+
7000,1,900,155,252,,,,
10+
8000,1,172800,6,12013,,,,
11+
9000,1,3600,111,36,1.8511046269271951,0,12415575.890133914,223612927
12+
10000,1,21600,9,5993,,,,
13+
11000,1,3600,18425,1346,,,,
14+
12000,1,21600,9,7839,,,,
15+
13000,1,3600,22445,1321,,,,
16+
14000,1,3600,211,3,,,,
17+
15000,1,86400,1681,108,,,,
18+
16000,2,172800,2,85924,35.32048284494427,0,0,669471630.8666667
19+
17000,1,28800,48,39,,,,
20+
18000,1,7200,0,611,1.6317304418827532,0,0,242301667
21+
19000,1,21600,12,1662,,,,
22+
20000,1,21600,26,7206,,,,
23+
21000,1,3600,0,1095,20.298036056662443,307784.68622169655,0,377195866
24+
22000,1,172800,3,280,87.38755792994296,,,131463737856
25+
23000,1,960,3,42,1.573028452792688,0,0,153550667
26+
24000,1,960,0,42,1.4618214897575181,0,0,141788220
27+
25000,256,172800,169623,169681,90.53302268073315,716.4750310720816,110578427985.13992,426185127.56684494
28+
26000,1,21600,13,72,49.75276270147344,,,118342819840
29+
27000,1,21600,191,36,,,,
30+
28000,1,21600,17,21,,,,
31+
29000,1,1800,11,211,50.00127478407303,,,124171051827.2
32+
30000,1,21600,328,184,36.69212927476799,,,144036221952
33+
31000,1,18000,13,6,,,,
34+
32000,1,960,1,41,1.5277511080658916,0,0,172152952
35+
33000,1,129600,476,15,,,,
36+
34000,1,172800,1,15897,98.96305566793583,,,105552713859.87883
37+
35000,1,7200,0,7217,,,,
38+
36000,1,21600,1,93,17.130505149503232,,,147102908416
39+
37000,1,21600,11,150,1.5495503254849237,,,155952593578.66666
40+
38000,1,21600,1,256,31.266221286764996,,,60418209792
41+
39000,1,21600,334,10,,,,
42+
40000,1,21600,334,221,6.50711299161715,,,53499913011.2
43+
41000,1,3600,1,115,0.2959079693229115,,,163743516672
44+
42000,4,7200,0,7215,98.47234983404904,441.1070124335988,4020681635.3062363,1288843817.88

tests/regression/data/realms.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ Cloud,Cloud
55
Gateways,Gateways
66
Jobs,Jobs
77
Requests,Requests
8+
ResourceSpecifications,Resource Specifications
89
SUPREMM,SUPREMM

xdmod_data/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
__title__ = 'xdmod-data'
2-
__version__ = '2.0.0-01'
2+
__version__ = '1.0.2.dev1'

xdmod_data/_http_requester.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,12 @@ def _request_raw_data(self, params):
6363
response = {'fields': line_json}
6464
else:
6565
data.append(line_json)
66-
if params['show_progress']:
67-
progress_msg = (
68-
'Got ' + str(i) + ' row' + ('' if i == 1 else 's')
69-
+ '...'
70-
)
71-
print(progress_msg, end='\r')
66+
# Only print every 10,000 rows to avoid I/O rate errors.
67+
if params['show_progress'] and i % 10000 == 0:
68+
self.__print_progress_msg(i, '\r')
7269
i += 1
7370
if params['show_progress']:
74-
print(progress_msg + 'DONE')
71+
self.__print_progress_msg(i, 'DONE\n')
7572
else:
7673
num_rows = limit
7774
offset = 0
@@ -83,16 +80,11 @@ def _request_raw_data(self, params):
8380
partial_data = response['data']
8481
data += partial_data
8582
if params['show_progress']:
86-
progress_msg = (
87-
'Got ' + str(len(data)) + ' row'
88-
+ ('' if len(data) == 1 else 's')
89-
+ '...'
90-
)
91-
print(progress_msg, end='\r')
83+
self.__print_progress_msg(len(data), '\r')
9284
num_rows = len(partial_data)
9385
offset += limit
9486
if params['show_progress']:
95-
print(progress_msg + 'DONE')
87+
self.__print_progress_msg(len(data), 'DONE\n')
9688
return (data, response['fields'])
9789

9890
def _request_filter_values(self, realm_id, dimension_id):
@@ -210,3 +202,10 @@ def __get_raw_data_limit(self):
210202
else:
211203
raise
212204
return self.__raw_data_limit
205+
206+
def __print_progress_msg(self, num_rows, end='\n'):
207+
progress_msg = (
208+
'Got ' + str(num_rows) + ' row' + ('' if num_rows == 1 else 's')
209+
+ '...'
210+
)
211+
print(progress_msg, end=end)

0 commit comments

Comments
 (0)