Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect input / output ports of components via getters, instead of overwriting object references #329

Merged
merged 1 commit into from
Jun 11, 2024

Conversation

treo
Copy link
Contributor

@treo treo commented Jun 11, 2024

Description

We ran into the issue that using sub xircuits only really worked when the parameters passed to them were literals. If the output of another component was passed, the value would end up being None because the InArg object is overwritten with the OutArg object of its input, thereby producing stale references within the component.

By overwriting the getter of the InArg to simply produce the value of the OutArg we don't run into this particular problem anymore.

In principle I'd prefer if we had a more explicit InArg.connect(OutArg) kind of thing instead of using setattr in the generated code, but that requires a change in the base components definition, and that in turn requires users to update files manually. And I'd prefer not to do that for a change that is targeted for a patch release.

Pull Request Type

  • Xircuits Core (Jupyterlab Related changes)
  • Xircuits Canvas (Custom RD Related changes)
  • Xircuits Component Library
  • Xircuits Project Template
  • Testing Automation
  • Documentation
  • Others (Please Specify)

Type of Change

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

Tests

1. Manual Test

1. Create a Workflow component that takes an input via an argument and prints it
2. Use that Workflow component in a parent xircuits file (e.g. connect a literal to concat string and use the output of concat string for the input to the sub xircuit workflow component)
3. Before the change: The component prints `None`; After the change: The component prints the output of concat. 

Tested on?

  • Windows
  • Linux Ubuntu
  • Centos
  • Mac
  • Others (State here -> xxx )

@treo treo requested a review from MFA-X-AI June 11, 2024 13:52
Copy link

Binder 👈 Launch a binder notebook on branch XpressAI/xircuits/paul/fix-multi-arg-use-in-subxircuits

@MFA-X-AI MFA-X-AI merged commit 989be69 into master Jun 11, 2024
9 checks passed
@MFA-X-AI MFA-X-AI deleted the paul/fix-multi-arg-use-in-subxircuits branch July 22, 2024 17:33
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