Extend plugin_executor to catch warnings during msg construction and …#104
Conversation
ac6e008 to
2103a45
Compare
…append the plugin filepath to the warning message.
1fb0c03 to
09daad6
Compare
9844df5 to
47673b2
Compare
|
Carwyn Pelley (@cpelley) In order to get the CI to run I had to make changes to how the code is checked out for forks. I'm not expecting this to be merged I just wanted the CI to run. The change to the docs could feasibly me merged as it just ensures that when we push from a fork we skip the task that pushes the documentation. I know I need to add my name to contributors but I figured I'd let you feedback first. |
| - name: Commit and push documentation changes | ||
| if: steps.check-docs.outputs.changed == 'true' | ||
|
|
||
| if: ${{ steps.check-docs.outputs.changed == 'true' && !github.event.pull_request.head.repo.fork }} |
There was a problem hiding this comment.
Apologies for this. I updated the repository to require forks without consideration of the its impact to the actions.
Let's go with your changes to the workflow for now -- I'll put on my todo to update the actions to properly work with forks 👍
There was a problem hiding this comment.
Hi. Sorry I've been on leave. I'm actually not sure what the request is here. Do you mean we should keep my changes to workflows/tests.yml for now? If so what are next steps?
|
|
||
| msg = f"{obj_name}{call_msg}(*{args}, **{callable_kwargs})" | ||
| obj_path = get_object_path(callable_obj) | ||
| with warnings.catch_warnings(record=True) as caught_warnings: |
There was a problem hiding this comment.
This context manager isn't around the execution of the application itself (only the definition of a string) so isn't actually doing anything currently.
| msg = f"{obj_name}{call_msg}(*{args}, **{callable_kwargs})" | ||
| for warning in caught_warnings: | ||
| warnings.warn( | ||
| message=f"[Plugin: {obj_path}] | {warning.message}", |
There was a problem hiding this comment.
Following precedence of the extra context we provide to exception messages raised by applications executed, we should provide similar context to the conditions which led to warning -- object name (application) and the parameters we provided it. This helps users determine the circumstances that resulted in this warning.
| return nxgraph | ||
|
|
||
|
|
||
| def get_object_path(obj): |
There was a problem hiding this comment.
Should likely not live inside this same module.
There was a problem hiding this comment.
I have addressed issues with this workflow file for running from forks now.
| def test_func(): ... | ||
|
|
||
|
|
||
| class TestClass: ... | ||
|
|
||
|
|
||
| TEST_INSTANCE = TestClass() | ||
| TEST_LAMBDA = lambda: None | ||
| TEST_STRING = os.path.abspath(__file__) | ||
|
|
||
| TEST_CASES = [test_func, TestClass, TEST_INSTANCE, TEST_LAMBDA, TEST_STRING] |
There was a problem hiding this comment.
Some/all of these will be picked up as tests in the pytest test discover due to naming. Use of 'Dummy' or similar would avoid this.
|
robertplatt-mo, Joshua Wiggs (@JoshuaWiggs) — thanks for the work on this. I don’t currently see how the PR, in its present form, is able to function as intended (see comments above). dagrunner/dagrunner/execute_graph.py Lines 208 to 214 in 62380e3 Additionally, this change likely needs some consideration in the broader context of DAGrunner’s logging and monitoring framework. |
…append the plugin filepath to the warning message.