Skip to content

Remove site_config.reparse_args#424

Merged
BrianJKoopman merged 1 commit intomainfrom
koopman/remove-reparse-args
May 21, 2025
Merged

Remove site_config.reparse_args#424
BrianJKoopman merged 1 commit intomainfrom
koopman/remove-reparse-args

Conversation

@BrianJKoopman
Copy link
Member

Description

This PR removes the site_config.reparse_args() function. There was still one lingering use in client_t.run_control_script, so we remove that here as well.

Motivation and Context

This has been deprecated since v0.6.0, back in March 2020. This is a part of some code clean up efforts.

How Has This Been Tested?

I still need to test this, specifically the client_t.run_control_script change. Draft until then, though comments welcome.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code cleanup

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@BrianJKoopman BrianJKoopman force-pushed the koopman/remove-reparse-args branch from 7952c1f to 6fbc0ab Compare May 20, 2025 19:42
@BrianJKoopman
Copy link
Member Author

Alright, I tested this change now by doing the following:

  1. Start up a crossbar server in Docker
  2. Start up a FakeDataAgent in Docker
  3. Run the below run_control_script snippet to start a 'delay_task' (based on this example)
  4. Check the task ran successfully using an OCSClient
import ocs

from ocs.client_t import (
    ProcessClient,
    run_control_script,
    TaskClient,
)

def my_client_function(app, *args, **kwargs):
    root = 'observatory'
    instance = 'fake-data1'

    # Register addresses and operations
    address = '{}.{}'.format(root, instance)
    ops = {
        'delay': TaskClient(app, address, 'delay_task'),
        'acq': ProcessClient(app, address, 'acq')
    }

    yield ops['delay'].start()
    yield ops['delay'].wait()
    status = yield ops['delay'].status()
    print(status)


run_control_script(my_client_function)

Before and after the pending changes this worked without much issue:

$ python3 test_client_t.py
2025-05-20T15:32:20-0400 transport connected
2025-05-20T15:32:20-0400 Unable to format event {'log_logger': <Logger 'ocs.client_t.ControlClientSession'>, 'log_level': <LogLevel=info>, 'log_namespace': 'ocs.client_t.ControlClientSession', 'log_source': None, 'log_format': "session joined: {'authextra': {'x_cb_node': '14f5bfb4e541-8',\n               'x_cb_peer': 'tcp4:192.168.64.1:36698',\n               'x_cb_pid': 23,\n               'x_cb_worker': 'worker001'},\n 'authid': '7FFH-PU7L-9R5Y-AJ54-CLAC-SXVT',\n 'authmethod': 'anonymous',\n 'authprovider': 'static',\n 'authrole': 'iocs_agent',\n 'realm': 'test_realm',\n 'resumable': False,\n 'resume_token': None,\n 'resumed': False,\n 'serializer': 'cbor.batched',\n 'session': 1019812085657996,\n 'transport': {'channel_framing': 'websocket',\n               'channel_id': {},\n               'channel_serializer': None,\n               'channel_type': 'tcp',\n               'http_cbtid': None,\n               'http_headers_received': None,\n               'http_headers_sent': None,\n               'is_secure': False,\n               'is_server': False,\n               'own': None,\n               'own_fd': -1,\n               'own_pid': 903084,\n               'own_tid': 903084,\n               'peer': 'tcp4:127.0.0.1:8001',\n               'peer_cert': None,\n               'websocket_extensions_in_use': None,\n               'websocket_protocol': None}}", 'log_time': 1747769540.1419551}: "'authextra'"
2025-05-20T15:32:25-0400 [0, 'Session active.', {'session_id': 3, 'op_name': 'delay_task', 'op_code': 5, 'status': 'done', 'degraded': False, 'success': True, 'start_time': 1747769540.143587, 'end_time': 1747769545.1454349, 'data': {'requested_delay': 5.0, 'delay_so_far': 5.00102424621582}, 'messages': [[1747769540.143587, 'Status is now "starting".'], [1747769540.1439984, 'Status is now "running".'], [1747769545.145171, 'Exited after 5.0 seconds'], [1747769545.1454349, 'Status is now "done".']]}]
2025-05-20T15:32:25-0400 session left: CloseDetails(reason=<wamp.close.normal>, message='None')
2025-05-20T15:32:25-0400 transport disconnected
2025-05-20T15:32:25-0400 Scheduling retry 1 to connect <twisted.internet.endpoints.TCP4ClientEndpoint object at 0x726dd166f110> in 2.0101711270449596 seconds.
2025-05-20T15:32:25-0400 Main loop terminated.

This is now ready for review.

@BrianJKoopman BrianJKoopman marked this pull request as ready for review May 20, 2025 19:47
@BrianJKoopman BrianJKoopman requested a review from mhasself May 20, 2025 19:47
@BrianJKoopman BrianJKoopman merged commit f51cf93 into main May 21, 2025
5 checks passed
@BrianJKoopman BrianJKoopman deleted the koopman/remove-reparse-args branch May 21, 2025 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants