Skip to content

Commit dabe6a6

Browse files
committed
fix: Multiple
- Make module paths w.r.t `/` and not `drishti/` - Ensure Python 3.8 compatibility
1 parent ee02934 commit dabe6a6

File tree

4 files changed

+60
-56
lines changed

4 files changed

+60
-56
lines changed

drishti/handlers/handle_darshan.py

Lines changed: 53 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,24 @@
1111
import sys
1212
import time
1313
import typing
14+
from typing import Dict
1415
from dataclasses import dataclass, field
1516
from typing import List, Optional
1617

1718
import darshan
1819
import darshan.backend.cffi_backend as darshanll
19-
import includes.config as config
20-
import includes.module as module
2120
import pandas as pd
22-
from includes.module import HIGH, RECOMMENDATIONS, WARN, Panel, insights_total
23-
24-
# from includes.module import *
25-
from includes.parser import args
2621
from packaging import version
2722
from rich import print
2823
from rich.padding import Padding
2924

25+
import drishti.includes.config as config
26+
import drishti.includes.module as module
27+
from drishti.includes.module import HIGH, RECOMMENDATIONS, WARN, Panel, insights_total
28+
29+
# from includes.module import *
30+
from drishti.includes.parser import args
31+
3032

3133
def is_available(name):
3234
"""Check whether `name` is on PATH and marked as executable."""
@@ -98,7 +100,7 @@ class AbstractDarshanTrace(abc.ABC):
98100

99101
# Report
100102
modules: typing.Iterable[str]
101-
name_records: dict[str, str] = field(default_factory=dict)
103+
name_records: Dict[str, str] = field(default_factory=dict)
102104

103105
max_read_offset: int = float('-inf')
104106
max_write_offset: int = float('-inf')
@@ -108,7 +110,7 @@ class AbstractDarshanTrace(abc.ABC):
108110
total_files_posix: int = 0
109111
total_files_mpiio: int = 0
110112

111-
files: dict[str, dict[str, int]] = None
113+
files: Dict[str, Dict[str, int]] = None
112114

113115
total_reads: int = 0
114116
total_writes: int = 0
@@ -165,7 +167,7 @@ class AbstractDarshanTrace(abc.ABC):
165167
# TODO: Should be a list of CB nodes for agg
166168
cb_nodes: Optional[int] = None
167169
number_of_compute_nodes: int = 0
168-
hints: list[str] = dataclasses.field(default_factory=list)
170+
hints: List[str] = dataclasses.field(default_factory=list)
169171

170172
job_start: Optional[datetime.datetime] = None
171173
job_end: Optional[datetime.datetime] = None
@@ -346,61 +348,62 @@ def _do_something(self):
346348
# TODO: for trace in traces
347349
for trace in self.traces:
348350
pass
349-
module.check_misaligned(self.total_operations, self.total_mem_not_aligned, self.total_file_not_aligned,
350-
self.modules, self.name_records, self.lustre_df, self.dxt_posix,
351-
self.dxt_posix_read_data) # posix alignment
351+
# module.check_misaligned(self.total_operations, self.total_mem_not_aligned, self.total_file_not_aligned,
352+
# self.modules, self.name_records, self.lustre_df, self.dxt_posix,
353+
# self.dxt_posix_read_data) # posix alignment
352354

353-
module.check_traffic(self.max_read_offset, self.total_read_size, self.max_write_offset, self.total_written_size,
354-
self.dxt_posix, self.dxt_posix_read_data, self.dxt_posix_write_data) # redundant reads
355+
# module.check_traffic(self.max_read_offset, self.total_read_size, self.max_write_offset, self.total_written_size,
356+
# self.dxt_posix, self.dxt_posix_read_data, self.dxt_posix_write_data) # redundant reads
355357

356-
module.check_random_operation(self.read_consecutive, self.read_sequential, self.read_random, self.total_reads,
357-
self.write_consecutive, self.write_sequential, self.write_random,
358-
self.total_writes, self.dxt_posix,
359-
self.dxt_posix_read_data, self.dxt_posix_write_data) # random check
358+
# module.check_random_operation(self.read_consecutive, self.read_sequential, self.read_random, self.total_reads,
359+
# self.write_consecutive, self.write_sequential, self.write_random,
360+
# self.total_writes, self.dxt_posix,
361+
# self.dxt_posix_read_data, self.dxt_posix_write_data) # random check
360362

361-
module.check_shared_small_operation(self.total_shared_reads, self.total_shared_reads_small,
362-
self.total_shared_writes,
363-
self.total_shared_writes_small, self.shared_files, self.report.name_records)
363+
# module.check_shared_small_operation(self.total_shared_reads, self.total_shared_reads_small,
364+
# self.total_shared_writes,
365+
# self.total_shared_writes_small, self.shared_files, self.report.name_records)
364366

365367
module.check_long_metadata(self.count_long_metadata, self.modules)
366368

367-
module.check_shared_data_imblance(self.posix_shared_data_imbalance_stragglers_count,
368-
self.posix_data_straggler_files,
369-
self.report.name_records, self.dxt_posix,
370-
self.dxt_posix_read_data,
371-
self.dxt_posix_write_data)
372-
373-
module.check_shared_time_imbalance(self.posix_stragglers_shared_file_time_imbalance_count,
374-
self.posix_shared_time_imbalance_detected_files1, self.report.name_records)
375-
376-
module.check_individual_write_imbalance(self.posix_data_imbalance_count,
377-
self.posix_shared_time_imbalance_detected_files2,
378-
self.report.name_records, self.dxt_posix, self.dxt_posix_write_data)
369+
# module.check_shared_data_imblance(self.posix_shared_data_imbalance_stragglers_count,
370+
# self.posix_data_straggler_files,
371+
# self.report.name_records, self.dxt_posix,
372+
# self.dxt_posix_read_data,
373+
# self.dxt_posix_write_data)
379374

380-
module.check_mpi_collective_read_operation(self.mpiio_coll_reads, self.mpiio_indep_reads,
381-
self.total_mpiio_read_operations,
382-
self.detected_files_mpi_coll_reads, self.report.name_records,
383-
self.dxt_mpiio)
375+
# module.check_shared_time_imbalance(self.posix_stragglers_shared_file_time_imbalance_count,
376+
# self.posix_shared_time_imbalance_detected_files1, self.report.name_records)
384377

385-
module.check_mpi_collective_write_operation(self.mpiio_coll_writes, self.mpiio_indep_writes,
386-
self.total_mpiio_write_operations,
387-
self.detected_files_mpiio_coll_writes, self.report.name_records, self.dxt_mpiio)
378+
# module.check_individual_write_imbalance(self.posix_data_imbalance_count,
379+
# self.posix_shared_time_imbalance_detected_files2,
380+
# self.report.name_records, self.dxt_posix, self.dxt_posix_write_data)
388381

389-
module.check_individual_read_imbalance(self.imbalance_count_posix_shared_time,
390-
self.posix_shared_time_imbalance_detected_files3,
391-
self.report.name_records, self.dxt_posix, self.dxt_posix_read_data)
382+
# module.check_mpi_collective_read_operation(self.mpiio_coll_reads, self.mpiio_indep_reads,
383+
# self.total_mpiio_read_operations,
384+
# self.detected_files_mpi_coll_reads, self.report.name_records,
385+
# self.dxt_mpiio)
386+
387+
# module.check_mpi_collective_write_operation(self.mpiio_coll_writes, self.mpiio_indep_writes,
388+
# self.total_mpiio_write_operations,
389+
# self.detected_files_mpiio_coll_writes, self.report.name_records, self.dxt_mpiio)
390+
#
391+
# module.check_individual_read_imbalance(self.imbalance_count_posix_shared_time,
392+
# self.posix_shared_time_imbalance_detected_files3,
393+
# self.report.name_records, self.dxt_posix, self.dxt_posix_read_data)
392394

393395
module.check_mpi_none_block_operation(self.mpiio_nb_reads, self.mpiio_nb_writes, self.has_hdf5_extension,
394396
self.modules)
395397

396398

397399

398400
def _small_operation_insight(self):
399-
module.check_small_operation(self.total_reads, self.total_reads_small, self.total_writes,
400-
self.total_writes_small,
401-
self.small_operation_detected_files,
402-
self.modules, self.report.name_records, self.dxt_posix, self.dxt_posix_read_data,
403-
self.dxt_posix_write_data)
401+
pass
402+
# module.check_small_operation(self.total_reads, self.total_reads_small, self.total_writes,
403+
# self.total_writes_small,
404+
# self.small_operation_detected_files,
405+
# self.modules, self.report.name_records, self.dxt_posix, self.dxt_posix_read_data,
406+
# self.dxt_posix_write_data)
404407

405408

406409

@@ -921,7 +924,7 @@ def __init__(self, traces: List[DarshanTrace]):
921924
reports = [current_trace.report for current_trace in traces]
922925
self.name_records = dict()
923926
for report in reports:
924-
self.name_records |= report.name_records
927+
self.name_records.update(report.name_records) # self.name_records |= report.name_records
925928

926929
def aggregate_traces(self):
927930
self.modules = set()
@@ -953,7 +956,7 @@ def aggregate_traces(self):
953956
self.total_files_posix += current_trace.total_size_posix
954957
self.total_files_mpiio += current_trace.total_files_mpiio
955958

956-
self.files |= current_trace.files
959+
self.files.update(current_trace.files) # self.files |= current_trace.files
957960

958961
self.total_reads += current_trace.total_reads
959962
self.total_writes += current_trace.total_writes

drishti/includes/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import json
44
import os
55

6-
from includes.parser import *
6+
from drishti.includes.parser import *
77
from rich.console import Console, Group
88
from rich.padding import Padding
99
from rich.panel import Panel

drishti/includes/module.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import time
66

77
import pandas as pd
8-
from includes.config import *
8+
from drishti.includes.config import *
99
from rich import box
1010
from rich.syntax import Syntax
1111

drishti/reporter.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
import os
44
import sys
55
from subprocess import call
6+
from typing import List, Optional
67

78
# from includes.parser import * # imports {'parser', 'args', 'argparse'} # TODO: Is next line enuf
8-
from includes.parser import args
9+
from drishti.includes.parser import args
910

1011
'''
1112
|- handler_darshan -|
@@ -29,7 +30,7 @@ def clear():
2930
_ = call('clear' if os.name == 'posix' else 'cls')
3031

3132

32-
def check_log_type(paths: list[str]) -> int | None:
33+
def check_log_type(paths: List[str]) -> Optional[int]:
3334
is_darshan = True
3435
is_recorder = True
3536
multiple_logs = len(paths) > 1
@@ -70,10 +71,10 @@ def main():
7071
log_type = check_log_type(args.log_paths)
7172

7273
if log_type == LOG_TYPE_DARSHAN:
73-
from handlers.handle_darshan import handler
74+
from drishti.handlers.handle_darshan import handler
7475

7576
elif log_type == LOG_TYPE_RECORDER:
76-
from handlers.handle_recorder import handler
77+
from drishti.handlers.handle_recorder import handler
7778

7879
handler()
7980

0 commit comments

Comments
 (0)