awslabs / amazon-emr-cli

A command-line interface for packaging, deploying, and running your EMR Serverless Spark jobs
Apache License 2.0
35 stars 12 forks source link

--entry-point in subfolder does not work #7

Open dacort opened 1 year ago

dacort commented 1 year ago

If the entrypoint file is in a subfolder locally, it attempts to use that subfolder in constructing the entrypoint path on S3.

We should either:

kirillklimenko commented 10 months ago

Any updates?

dacort commented 10 months ago

Not as of yet - thanks for the bump, might try to take a look this week. Contributions also welcome.

dacort commented 10 months ago

@kirillklimenko I'd love to have more details about your use-case and/or expectations.

If I went with option 1 (truncate the folder when constructing the entrypoint), would that break anything for you like relative imports?

kirillklimenko commented 10 months ago

@dacort

I ran into an error when I passed a relative path to an entrypoint and it wasn't found for example:

dacort commented 10 months ago

Yep, makes sense - does your main.py reference modules relative to src/entrypoints?

For example, given a structure like this:

.
└── src
    ├── entrypoints
    │   ├── main.py
    │   └── vendor
    │       └── example.py
    └── utils
        └── udf.py

5 directories, 3 files

I could image if main.py were moved outside of the src/entrypoints folder and tried to use from vendor.example import Vendor it would fail.

from utils.udf import SomeFunction would likely still work as the Python project would get get packaged up properly.

kirillklimenko commented 10 months ago

@dacort

Yes, main.py has dependencies on the files inside the package.

If I move main.py from the entrypoints folder to the root and specify it as -- entrypoint main.py, then everything works, but if it is inside the package (the src folder), it does not work --entrypoint src/entrypoints/main.py.

I have multiple entrypoints in the entrypoints folder, so it doesn't make sense for me to put each one at the root of the project.

dacort commented 10 months ago

Ok, thank you, that's helpful!