Skip to content

handle components whose implementation lives in a different file #1075

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

daniel-ohayon
Copy link
Contributor

Summary:
Add support for cases like:

# some_file.py
# ====================
def my_component(...) -> specs.AppDef: ...

# other_file.py
# ====================
from some_file import my_component

where the component is invoked with
torchx run ... other_file.py:my_component

This was currently failing with a validation error because in the step where we inspect the AST of the component, we assume that the file where the component is being looked up is the same as the file where it is implemented.

Differential Revision: D75496839

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 28, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D75496839

daniel-ohayon pushed a commit to daniel-ohayon/torchx that referenced this pull request May 29, 2025
…orch#1075)

Summary:

Add support for cases like:
```lang=python
# some_file.py
# ====================
def my_component(...) -> specs.AppDef: ...

# other_file.py
# ====================
from some_file import my_component
```

where the component is invoked with
`torchx run ... other_file.py:my_component`

This was currently failing with a validation error because in the step where we inspect the AST of the component, we assume that the file where the component is being looked up is the same as the file where it is implemented.

Differential Revision: D75496839
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D75496839

daniel-ohayon pushed a commit to daniel-ohayon/torchx that referenced this pull request May 29, 2025
…orch#1075)

Summary:

Add support for cases like:
```lang=python
# some_file.py
# ====================
def my_component(...) -> specs.AppDef: ...

# other_file.py
# ====================
from some_file import my_component
```

where the component is invoked with
`torchx run ... other_file.py:my_component`

This was currently failing with a validation error because in the step where we inspect the AST of the component, we assume that the file where the component is being looked up is the same as the file where it is implemented.

Differential Revision: D75496839
daniel-ohayon pushed a commit to daniel-ohayon/torchx that referenced this pull request May 29, 2025
…orch#1075)

Summary:

Add support for cases like:
```lang=python
# some_file.py
# ====================
def my_component(...) -> specs.AppDef: ...

# other_file.py
# ====================
from some_file import my_component
```

where the component is invoked with
`torchx run ... other_file.py:my_component`

This was currently failing with a validation error because in the step where we inspect the AST of the component, we assume that the file where the component is being looked up is the same as the file where it is implemented.

Differential Revision: D75496839
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D75496839

daniel-ohayon pushed a commit to daniel-ohayon/torchx that referenced this pull request May 29, 2025
…orch#1075)

Summary:
Pull Request resolved: pytorch#1075

Add support for cases like:
```lang=python
# some_file.py
# ====================
def my_component(...) -> specs.AppDef: ...

# other_file.py
# ====================
from some_file import my_component
```

where the component is invoked with
`torchx run ... other_file.py:my_component`

This was currently failing with a validation error because in the step where we inspect the AST of the component, we assume that the file where the component is being looked up is the same as the file where it is implemented.

Differential Revision: D75496839
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D75496839

daniel-ohayon pushed a commit to daniel-ohayon/torchx that referenced this pull request May 29, 2025
…orch#1075)

Summary:
Pull Request resolved: pytorch#1075

Add support for cases like:
```lang=python
# some_file.py
# ====================
def my_component(...) -> specs.AppDef: ...

# other_file.py
# ====================
from some_file import my_component
```

where the component is invoked with
`torchx run ... other_file.py:my_component`

This was currently failing with a validation error because in the step where we inspect the AST of the component, we assume that the file where the component is being looked up is the same as the file where it is implemented.

Differential Revision: D75496839
@daniel-ohayon daniel-ohayon requested a review from kiukchung June 2, 2025 14:10
daniel-ohayon pushed a commit to daniel-ohayon/torchx that referenced this pull request Jun 2, 2025
…orch#1075)

Summary:

Add support for cases like:
```lang=python
# some_file.py
# ====================
def my_component(...) -> specs.AppDef: ...

# other_file.py
# ====================
from some_file import my_component
```

where the component is invoked with
`torchx run ... other_file.py:my_component`

This was currently failing with a validation error because in the step where we inspect the AST of the component, we assume that the file where the component is being looked up is the same as the file where it is implemented.

Reviewed By: kiukchung

Differential Revision: D75496839
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D75496839

daniel-ohayon pushed a commit to daniel-ohayon/torchx that referenced this pull request Jun 2, 2025
…orch#1075)

Summary:
Pull Request resolved: pytorch#1075

Add support for cases like:
```lang=python
# some_file.py
# ====================
def my_component(...) -> specs.AppDef: ...

# other_file.py
# ====================
from some_file import my_component
```

where the component is invoked with
`torchx run ... other_file.py:my_component`

This was currently failing with a validation error because in the step where we inspect the AST of the component, we assume that the file where the component is being looked up is the same as the file where it is implemented.

Reviewed By: kiukchung

Differential Revision: D75496839
daniel-ohayon pushed a commit to daniel-ohayon/torchx that referenced this pull request Jun 2, 2025
…orch#1075)

Summary:

Add support for cases like:
```lang=python
# some_file.py
# ====================
def my_component(...) -> specs.AppDef: ...

# other_file.py
# ====================
from some_file import my_component
```

where the component is invoked with
`torchx run ... other_file.py:my_component`

This was currently failing with a validation error because in the step where we inspect the AST of the component, we assume that the file where the component is being looked up is the same as the file where it is implemented.

Reviewed By: kiukchung

Differential Revision: D75496839
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D75496839

daniel-ohayon pushed a commit to daniel-ohayon/torchx that referenced this pull request Jun 2, 2025
…orch#1075)

Summary:
Pull Request resolved: pytorch#1075

Add support for cases like:
```lang=python
# some_file.py
# ====================
def my_component(...) -> specs.AppDef: ...

# other_file.py
# ====================
from some_file import my_component
```

where the component is invoked with
`torchx run ... other_file.py:my_component`

This was currently failing with a validation error because in the step where we inspect the AST of the component, we assume that the file where the component is being looked up is the same as the file where it is implemented.

Reviewed By: kiukchung

Differential Revision: D75496839
daniel-ohayon pushed a commit to daniel-ohayon/torchx that referenced this pull request Jun 3, 2025
…orch#1075)

Summary:

Add support for cases like:
```lang=python
# some_file.py
# ====================
def my_component(...) -> specs.AppDef: ...

# other_file.py
# ====================
from some_file import my_component
```

where the component is invoked with
`torchx run ... other_file.py:my_component`

This was currently failing with a validation error because in the step where we inspect the AST of the component, we assume that the file where the component is being looked up is the same as the file where it is implemented.

Reviewed By: kiukchung

Differential Revision: D75496839
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D75496839

daniel-ohayon pushed a commit to daniel-ohayon/torchx that referenced this pull request Jun 3, 2025
…orch#1075)

Summary:
Pull Request resolved: pytorch#1075

Add support for cases like:
```lang=python
# some_file.py
# ====================
def my_component(...) -> specs.AppDef: ...

# other_file.py
# ====================
from some_file import my_component
```

where the component is invoked with
`torchx run ... other_file.py:my_component`

This was currently failing with a validation error because in the step where we inspect the AST of the component, we assume that the file where the component is being looked up is the same as the file where it is implemented.

Reviewed By: kiukchung

Differential Revision: D75496839
…orch#1075)

Summary:

Add support for cases like:
```lang=python
# some_file.py
# ====================
def my_component(...) -> specs.AppDef: ...

# other_file.py
# ====================
from some_file import my_component
```

where the component is invoked with
`torchx run ... other_file.py:my_component`

This was currently failing with a validation error because in the step where we inspect the AST of the component, we assume that the file where the component is being looked up is the same as the file where it is implemented.

Reviewed By: kiukchung

Differential Revision: D75496839
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D75496839

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants