Skip to content

Commit

Permalink
applying a code formatting pass to make the bots happy
Browse files Browse the repository at this point in the history
Signed-off-by: Karl W Schulz <[email protected]>
  • Loading branch information
koomie committed Jul 8, 2024
1 parent 23f78d3 commit d7f7827
Show file tree
Hide file tree
Showing 19 changed files with 510 additions and 447 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def install(package):
# -- Options for HTMLHelp output ---------------------------------------------

# Output file base name for HTML help builder.
#htmlhelp_basename = "Omniper"
# htmlhelp_basename = "Omniper"

html_logo = "images/amd-header-logo.svg"
html_theme_options = {
Expand Down
12 changes: 6 additions & 6 deletions omnistat-annotate
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#!/usr/bin/env python3
#!/usr/bin/env python3
# ------------------------------------------------------------------------------- # -------------------------------------------------------------------------------
# MIT License
#
#
# Copyright (c) 2023 - 2024 Advanced Micro Devices, Inc. All Rights Reserved.
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand All @@ -36,5 +36,5 @@ except:
print("Unable to load omnistat.annotate. Please verify installation.")
sys.exit(1)

if __name__ == '__main__':
if __name__ == "__main__":
sys.exit(main())
12 changes: 6 additions & 6 deletions omnistat-monitor
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#!/usr/bin/env python3
#!/usr/bin/env python3
# ------------------------------------------------------------------------------- # -------------------------------------------------------------------------------
# MIT License
#
#
# Copyright (c) 2023 - 2024 Advanced Micro Devices, Inc. All Rights Reserved.
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand All @@ -36,5 +36,5 @@ except:
print("Unable to load omnistat.node_monitoring. Please verify installation.")
sys.exit(1)

if __name__ == '__main__':
if __name__ == "__main__":
sys.exit(main())
12 changes: 6 additions & 6 deletions omnistat-query
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#!/usr/bin/env python3
#!/usr/bin/env python3
# ------------------------------------------------------------------------------- # -------------------------------------------------------------------------------
# MIT License
#
#
# Copyright (c) 2023 - 2024 Advanced Micro Devices, Inc. All Rights Reserved.
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand All @@ -36,5 +36,5 @@ except:
print("Unable to load omnistat.query. Please verify installation.")
sys.exit(1)

if __name__ == '__main__':
if __name__ == "__main__":
sys.exit(main())
12 changes: 6 additions & 6 deletions omnistat-slurm-env
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#!/usr/bin/env python3
#!/usr/bin/env python3
# ------------------------------------------------------------------------------- # -------------------------------------------------------------------------------
# MIT License
#
#
# Copyright (c) 2023 - 2024 Advanced Micro Devices, Inc. All Rights Reserved.
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand All @@ -36,5 +36,5 @@ except:
print("Unable to load omnistat.slurm_env. Please verify installation.")
sys.exit(1)

if __name__ == '__main__':
if __name__ == "__main__":
sys.exit(main())
12 changes: 6 additions & 6 deletions omnistat-usermode
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#!/usr/bin/env python3
#!/usr/bin/env python3
# ------------------------------------------------------------------------------- # -------------------------------------------------------------------------------
# MIT License
#
#
# Copyright (c) 2023 - 2024 Advanced Micro Devices, Inc. All Rights Reserved.
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand All @@ -36,5 +36,5 @@ except:
print("Unable to load omnistat.omni_util. Please verify installation.")
sys.exit(1)

if __name__ == '__main__':
if __name__ == "__main__":
sys.exit(main())
29 changes: 16 additions & 13 deletions omnistat/annotate.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#!/usr/bin/env python3
# -------------------------------------------------------------------------------
# MIT License
#
#
# Copyright (c) 2023 - 2024 Advanced Micro Devices, Inc. All Rights Reserved.
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand All @@ -39,17 +39,18 @@
import json
import os

class omnistat_annotate():

class omnistat_annotate:
def __init__(self):
self.filename="/tmp/omnistat_" + os.environ.get('USER') + "_annotate.json"
self.filename = "/tmp/omnistat_" + os.environ.get("USER") + "_annotate.json"

def start(self,label):
def start(self, label):
data = {}
data["annotation"] = label
data["timestamp_secs"] = int(time.time())

with open(self.filename,"w") as outfile:
outfile.write(json.dumps(data,indent=4))
with open(self.filename, "w") as outfile:
outfile.write(json.dumps(data, indent=4))
outfile.write("\n")
return

Expand All @@ -58,14 +59,15 @@ def stop(self):
os.remove(self.filename)
return


def main():
parser = argparse.ArgumentParser()
parser.add_argument("--mode", choices = ['start','stop'],help="annotation mode", required=True)
parser.add_argument("--mode", choices=["start", "stop"], help="annotation mode", required=True)
parser.add_argument("--text", help="desired annotation", required=False)
args = parser.parse_args()

if args.mode == 'start' and args.text is None:
parser.error("The --text option is required for \"start\" mode.")
if args.mode == "start" and args.text is None:
parser.error('The --text option is required for "start" mode.')

annotate = omnistat_annotate()

Expand All @@ -74,5 +76,6 @@ def main():
else:
annotate.stop()

if __name__ == '__main__':

if __name__ == "__main__":
main()
19 changes: 9 additions & 10 deletions omnistat/collector_base.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# -------------------------------------------------------------------------------
# MIT License
#
#
# Copyright (c) 2023 - 2024 Advanced Micro Devices, Inc. All Rights Reserved.
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand All @@ -24,22 +24,21 @@

# Prometheus data collector for HPC systems.
#
# Base Collector class - defines required methods for all metric collectors
# Base Collector class - defines required methods for all metric collectors
# implemented as a child class.
#--
# --

from abc import ABC, abstractmethod


class Collector(ABC):
# Required methods to be implemented by child classes
@abstractmethod
def registerMetrics(self):
"""Defines desired metrics to monitor with Prometheus. Called once during initialization.
"""
"""Defines desired metrics to monitor with Prometheus. Called once during initialization."""
pass

@abstractmethod
def updateMetrics(self):
"""Updates defined metrics with latest values. Called at every polling interval.
"""
"""Updates defined metrics with latest values. Called at every polling interval."""
pass
Loading

0 comments on commit d7f7827

Please sign in to comment.