From a815e47e2b92f40c66c04b0da36fb9d607de0991 Mon Sep 17 00:00:00 2001 From: Dave DeBoer Date: Mon, 25 Apr 2022 09:47:04 -0700 Subject: [PATCH 1/5] change dir name to docs and edit README for that --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1f1bca089..abf9ac311 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This is the main repository for HERA's monitor and control subsystems. # Documentation A detailed description of the monitor and control system and all the related database tables can be found in our -[description document](Docs/mc_definition.pdf). +[description document](docs/mc_definition.pdf). # Installation Installation instructions may be found in [INSTALL.md](./INSTALL.md). From b8ed0bf95d2e4723153b92cc56d1a340410a5c93 Mon Sep 17 00:00:00 2001 From: Dave DeBoer Date: Mon, 25 Apr 2022 09:59:28 -0700 Subject: [PATCH 2/5] updated precommit to new version --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 493abe5e0..8b96e7727 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,5 @@ repos: - - repo: git://github.com/pre-commit/pre-commit-hooks + - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.0.1 hooks: - id: trailing-whitespace @@ -13,7 +13,7 @@ repos: - id: end-of-file-fixer - id: mixed-line-ending args: ['--fix=no'] - - repo: https://gitlab.com/pycqa/flake8 + - repo: https://github.com/pycqa/flake8 rev: '3.9.2' hooks: - id: flake8 From 62990757f4bd5ee5bb3747124c4ceb4b5dbfb9c6 Mon Sep 17 00:00:00 2001 From: Paul La Plante Date: Mon, 25 Apr 2022 11:09:05 -0700 Subject: [PATCH 3/5] Rename Docs -> docs --- {Docs => docs}/cm_75ohm_legacy.tex | 0 {Docs => docs}/hookup.graffle | Bin {Docs => docs}/hookup.pdf | Bin {Docs => docs}/hookup_75ohm_legacy.graffle | Bin {Docs => docs}/mc_definition.pdf | Bin {Docs => docs}/mc_definition.tex | 0 {Docs => docs}/redis_correlator_keys.pdf | Bin {Docs => docs}/redis_correlator_keys.tex | 0 {Docs => docs}/time_conversion_function | 0 9 files changed, 0 insertions(+), 0 deletions(-) rename {Docs => docs}/cm_75ohm_legacy.tex (100%) rename {Docs => docs}/hookup.graffle (100%) rename {Docs => docs}/hookup.pdf (100%) rename {Docs => docs}/hookup_75ohm_legacy.graffle (100%) rename {Docs => docs}/mc_definition.pdf (100%) rename {Docs => docs}/mc_definition.tex (100%) rename {Docs => docs}/redis_correlator_keys.pdf (100%) rename {Docs => docs}/redis_correlator_keys.tex (100%) rename {Docs => docs}/time_conversion_function (100%) diff --git a/Docs/cm_75ohm_legacy.tex b/docs/cm_75ohm_legacy.tex similarity index 100% rename from Docs/cm_75ohm_legacy.tex rename to docs/cm_75ohm_legacy.tex diff --git a/Docs/hookup.graffle b/docs/hookup.graffle similarity index 100% rename from Docs/hookup.graffle rename to docs/hookup.graffle diff --git a/Docs/hookup.pdf b/docs/hookup.pdf similarity index 100% rename from Docs/hookup.pdf rename to docs/hookup.pdf diff --git a/Docs/hookup_75ohm_legacy.graffle b/docs/hookup_75ohm_legacy.graffle similarity index 100% rename from Docs/hookup_75ohm_legacy.graffle rename to docs/hookup_75ohm_legacy.graffle diff --git a/Docs/mc_definition.pdf b/docs/mc_definition.pdf similarity index 100% rename from Docs/mc_definition.pdf rename to docs/mc_definition.pdf diff --git a/Docs/mc_definition.tex b/docs/mc_definition.tex similarity index 100% rename from Docs/mc_definition.tex rename to docs/mc_definition.tex diff --git a/Docs/redis_correlator_keys.pdf b/docs/redis_correlator_keys.pdf similarity index 100% rename from Docs/redis_correlator_keys.pdf rename to docs/redis_correlator_keys.pdf diff --git a/Docs/redis_correlator_keys.tex b/docs/redis_correlator_keys.tex similarity index 100% rename from Docs/redis_correlator_keys.tex rename to docs/redis_correlator_keys.tex diff --git a/Docs/time_conversion_function b/docs/time_conversion_function similarity index 100% rename from Docs/time_conversion_function rename to docs/time_conversion_function From 84c87b8565b0840509ada1efc124627f15a510d2 Mon Sep 17 00:00:00 2001 From: Paul La Plante Date: Mon, 25 Apr 2022 11:12:05 -0700 Subject: [PATCH 4/5] Update pre-commit versions; make associated formatting changes --- .pre-commit-config.yaml | 6 +- .../a68c0e31204e_onsite_baseline_july_2017.py | 2 +- .../b1063869f198_bring_up_to_master.py | 80 +++++++++---------- hera_mc/cm_utils.py | 2 +- scripts/mc_server_status_daemon.py | 8 +- 5 files changed, 49 insertions(+), 49 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8b96e7727..57499b111 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 + rev: v4.2.0 hooks: - id: trailing-whitespace - id: check-added-large-files @@ -14,7 +14,7 @@ repos: - id: mixed-line-ending args: ['--fix=no'] - repo: https://github.com/pycqa/flake8 - rev: '3.9.2' + rev: '4.0.1' hooks: - id: flake8 additional_dependencies: @@ -25,6 +25,6 @@ repos: - flake8-rst-docstrings - repo: https://github.com/psf/black - rev: 21.11b1 + rev: 22.3.0 hooks: - id: black diff --git a/alembic/versions/a68c0e31204e_onsite_baseline_july_2017.py b/alembic/versions/a68c0e31204e_onsite_baseline_july_2017.py index 572d99453..0eed3b9c3 100644 --- a/alembic/versions/a68c0e31204e_onsite_baseline_july_2017.py +++ b/alembic/versions/a68c0e31204e_onsite_baseline_july_2017.py @@ -138,7 +138,7 @@ def upgrade(): sa.Column("created_date", sa.DateTime(timezone=True), nullable=False), sa.ForeignKeyConstraint( ["station_type_name"], - [u"station_type.station_type_name"], + ["station_type.station_type_name"], ), sa.PrimaryKeyConstraint("station_name"), ) diff --git a/alembic/versions/b1063869f198_bring_up_to_master.py b/alembic/versions/b1063869f198_bring_up_to_master.py index 0ea6f615d..8580b23e6 100644 --- a/alembic/versions/b1063869f198_bring_up_to_master.py +++ b/alembic/versions/b1063869f198_bring_up_to_master.py @@ -138,13 +138,13 @@ def upgrade(): ) op.drop_constraint("connections_pkey", "connections", type_="primary") op.add_column( - u"connections", sa.Column("start_gpstime", sa.BigInteger(), nullable=False) + "connections", sa.Column("start_gpstime", sa.BigInteger(), nullable=False) ) op.add_column( - u"connections", sa.Column("stop_gpstime", sa.BigInteger(), nullable=True) + "connections", sa.Column("stop_gpstime", sa.BigInteger(), nullable=True) ) - op.drop_column(u"connections", "stop_date") - op.drop_column(u"connections", "start_date") + op.drop_column("connections", "stop_date") + op.drop_column("connections", "start_date") op.create_primary_key( "connections_pkey", "connections", @@ -160,22 +160,22 @@ def upgrade(): ) op.add_column( - u"geo_location", sa.Column("created_gpstime", sa.BigInteger(), nullable=False) + "geo_location", sa.Column("created_gpstime", sa.BigInteger(), nullable=False) ) - op.drop_column(u"geo_location", "created_date") + op.drop_column("geo_location", "created_date") - op.add_column(u"hera_obs", sa.Column("jd_start", sa.Float(), nullable=False)) - op.add_column(u"hera_obs", sa.Column("starttime", sa.Float(), nullable=False)) - op.add_column(u"hera_obs", sa.Column("stoptime", sa.Float(), nullable=False)) - op.drop_column(u"hera_obs", "stop_time_jd") - op.drop_column(u"hera_obs", "start_time_jd") + op.add_column("hera_obs", sa.Column("jd_start", sa.Float(), nullable=False)) + op.add_column("hera_obs", sa.Column("starttime", sa.Float(), nullable=False)) + op.add_column("hera_obs", sa.Column("stoptime", sa.Float(), nullable=False)) + op.drop_column("hera_obs", "stop_time_jd") + op.drop_column("hera_obs", "start_time_jd") op.drop_constraint("paper_temperatures_pkey", "paper_temperatures", type_="primary") op.add_column( - u"paper_temperatures", sa.Column("time", sa.BigInteger(), nullable=False) + "paper_temperatures", sa.Column("time", sa.BigInteger(), nullable=False) ) - op.drop_column(u"paper_temperatures", "gps_time") - op.drop_column(u"paper_temperatures", "jd_time") + op.drop_column("paper_temperatures", "gps_time") + op.drop_column("paper_temperatures", "jd_time") op.create_primary_key( "paper_temperatures_pkey", "paper_temperatures", @@ -186,28 +186,28 @@ def upgrade(): op.drop_constraint("part_info_pkey", "part_info", type_="primary") op.add_column( - u"part_info", sa.Column("posting_gpstime", sa.BigInteger(), nullable=False) + "part_info", sa.Column("posting_gpstime", sa.BigInteger(), nullable=False) ) - op.drop_column(u"part_info", "posting_date") + op.drop_column("part_info", "posting_date") op.create_primary_key( "part_info_pkey", "part_info", ["hpn", "hpn_rev", "posting_gpstime"] ) op.add_column( - u"parts_paper", sa.Column("start_gpstime", sa.BigInteger(), nullable=False) + "parts_paper", sa.Column("start_gpstime", sa.BigInteger(), nullable=False) ) op.add_column( - u"parts_paper", sa.Column("stop_gpstime", sa.BigInteger(), nullable=True) + "parts_paper", sa.Column("stop_gpstime", sa.BigInteger(), nullable=True) ) - op.drop_column(u"parts_paper", "stop_date") - op.drop_column(u"parts_paper", "start_date") + op.drop_column("parts_paper", "stop_date") + op.drop_column("parts_paper", "start_date") # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column( - u"parts_paper", + "parts_paper", sa.Column( "start_date", postgresql.TIMESTAMP(timezone=True), @@ -216,7 +216,7 @@ def downgrade(): ), ) op.add_column( - u"parts_paper", + "parts_paper", sa.Column( "stop_date", postgresql.TIMESTAMP(timezone=True), @@ -224,10 +224,10 @@ def downgrade(): nullable=True, ), ) - op.drop_column(u"parts_paper", "stop_gpstime") - op.drop_column(u"parts_paper", "start_gpstime") + op.drop_column("parts_paper", "stop_gpstime") + op.drop_column("parts_paper", "start_gpstime") op.add_column( - u"part_info", + "part_info", sa.Column( "posting_date", postgresql.TIMESTAMP(timezone=True), @@ -235,9 +235,9 @@ def downgrade(): nullable=False, ), ) - op.drop_column(u"part_info", "posting_gpstime") + op.drop_column("part_info", "posting_gpstime") op.add_column( - u"paper_temperatures", + "paper_temperatures", sa.Column( "jd_time", postgresql.DOUBLE_PRECISION(precision=53), @@ -246,7 +246,7 @@ def downgrade(): ), ) op.add_column( - u"paper_temperatures", + "paper_temperatures", sa.Column( "gps_time", postgresql.DOUBLE_PRECISION(precision=53), @@ -254,9 +254,9 @@ def downgrade(): nullable=False, ), ) - op.drop_column(u"paper_temperatures", "time") + op.drop_column("paper_temperatures", "time") op.add_column( - u"hera_obs", + "hera_obs", sa.Column( "start_time_jd", postgresql.DOUBLE_PRECISION(precision=53), @@ -265,7 +265,7 @@ def downgrade(): ), ) op.add_column( - u"hera_obs", + "hera_obs", sa.Column( "stop_time_jd", postgresql.DOUBLE_PRECISION(precision=53), @@ -273,11 +273,11 @@ def downgrade(): nullable=False, ), ) - op.drop_column(u"hera_obs", "stoptime") - op.drop_column(u"hera_obs", "starttime") - op.drop_column(u"hera_obs", "jd_start") + op.drop_column("hera_obs", "stoptime") + op.drop_column("hera_obs", "starttime") + op.drop_column("hera_obs", "jd_start") op.add_column( - u"geo_location", + "geo_location", sa.Column( "created_date", postgresql.TIMESTAMP(timezone=True), @@ -285,9 +285,9 @@ def downgrade(): nullable=False, ), ) - op.drop_column(u"geo_location", "created_gpstime") + op.drop_column("geo_location", "created_gpstime") op.add_column( - u"connections", + "connections", sa.Column( "start_date", postgresql.TIMESTAMP(timezone=True), @@ -296,7 +296,7 @@ def downgrade(): ), ) op.add_column( - u"connections", + "connections", sa.Column( "stop_date", postgresql.TIMESTAMP(timezone=True), @@ -304,8 +304,8 @@ def downgrade(): nullable=True, ), ) - op.drop_column(u"connections", "stop_gpstime") - op.drop_column(u"connections", "start_gpstime") + op.drop_column("connections", "stop_gpstime") + op.drop_column("connections", "start_gpstime") op.drop_table("rtp_process_record") op.drop_table("rtp_process_event") op.drop_table("lib_files") diff --git a/hera_mc/cm_utils.py b/hera_mc/cm_utils.py index fb6b02f02..9ef91006d 100644 --- a/hera_mc/cm_utils.py +++ b/hera_mc/cm_utils.py @@ -622,7 +622,7 @@ def get_astropytime(adate, atime=None, float_format=None): atime ) ) - add_time += (float(d)) * 3600.0 / (60.0 ** i) + add_time += (float(d)) * 3600.0 / (60.0**i) return return_date + TimeDelta(add_time, format="sec") diff --git a/scripts/mc_server_status_daemon.py b/scripts/mc_server_status_daemon.py index 8475da1f6..36c472597 100755 --- a/scripts/mc_server_status_daemon.py +++ b/scripts/mc_server_status_daemon.py @@ -127,7 +127,7 @@ def get_ip_address(): cpu_load_pct = os.getloadavg()[1] / num_cores * 100.0 uptime_days = (time.time() - psutil.boot_time()) / 86400.0 - memory_size_gb = vmem.total / 1024 ** 3 # bytes => GiB + memory_size_gb = vmem.total / 1024**3 # bytes => GiB # We only track disk usage on the root filesystem partition. We could # potentially use `psutil.disk_partitions(all=False)` to try to track @@ -136,7 +136,7 @@ def get_ip_address(): # specialized channels. disk = psutil.disk_usage("/") - disk_size_gb = disk.total / 1024 ** 3 # bytes => GiB + disk_size_gb = disk.total / 1024**3 # bytes => GiB disk_space_pct = ( disk.percent ) # note, this is misnamed a bit - it's the % used @@ -145,12 +145,12 @@ def get_ip_address(): # `prev_index` so that the differences below give the total number # of bytes transferred since the last report. - memory_used_pct = (mem_buf.mean() / 1024 ** 3) * 100.0 / memory_size_gb + memory_used_pct = (mem_buf.mean() / 1024**3) * 100.0 / memory_size_gb tx_bytes = tx_buf[prev_index] - tx_buf[index] rx_bytes = rx_buf[prev_index] - rx_buf[index] network_bandwidth_mbs = ( - (tx_bytes + rx_bytes) / 1024 ** 2 / (now - last_report) + (tx_bytes + rx_bytes) / 1024**2 / (now - last_report) ) # Submit From f5e3f42396124dc19767fe14a67a4c2ef4a7ca70 Mon Sep 17 00:00:00 2001 From: Paul La Plante Date: Tue, 26 Apr 2022 15:03:47 -0700 Subject: [PATCH 5/5] Add new test to cover missed line --- hera_mc/tests/test_correlator.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hera_mc/tests/test_correlator.py b/hera_mc/tests/test_correlator.py index 95e423ee6..f9e3a5cf6 100644 --- a/hera_mc/tests/test_correlator.py +++ b/hera_mc/tests/test_correlator.py @@ -2809,3 +2809,10 @@ def test_redis_add_antenna_status_from_corrcm(mcsession): result = test_session.get_antenna_status(most_recent=True) assert len(result) >= 1 + + +def test_pam_fem_id_to_string_list(): + idno = ["fem0", "fem1"] + assert corr._pam_fem_id_to_string(idno) == "fem0:fem1" + + return