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

Eliminate confusing job option and format option handling in create_job (and related) #648

Open
soxofaan opened this issue Oct 24, 2024 · 4 comments

Comments

@soxofaan
Copy link
Member

@mbuchhorn pointed me to this snippet from doc:

job = s2_bands.create_job(
title="Sentinel2",
description="Sentinel-2 L2A bands",
out_format="netCDF",
sample_by_feature=True,
)

I find this extremely confusing: the sample_by_feature looks like a job option this way, while the kwargs will be passed as format option:

def create_job(
self,
out_format: Optional[str] = None,
*,
title: Optional[str] = None,
description: Optional[str] = None,
plan: Optional[str] = None,
budget: Optional[float] = None,
job_options: Optional[dict] = None,
validate: Optional[bool] = None,
auto_add_save_result: bool = True,
# TODO: avoid `format_options` as keyword arguments
**format_options,

Note that there is a dedicated argument job_options for the job options, but the kwargs argument goes to format options, which is an optional feature here actually. I think we should get rid of this backwards argument handling

@soxofaan
Copy link
Member Author

Same problem with:

  • DataCube.create_job(..., **format_options)
  • DataCube.execute_batch(..., **format_options)
  • VectorCube.create_job(..., **format_options)
  • VectorCube.execute_batch(..., **format_options)

@bossie
Copy link
Collaborator

bossie commented Oct 24, 2024

I had the same problem yesterday where I tried to pass a title to execute_batch but it treated it as a format option. I believe I got an error back so I changed it to create_job.

@soxofaan
Copy link
Member Author

I had the same problem yesterday where I tried to pass a title to execute_batch but it treated it as a format option. I believe I got an error back so I changed it to create_job.

aargh same here: I was looking into CDSE integration tests that uses cube.execute_batch(title=... and couldn't understand why the tile was not showing up in the job registry

@soxofaan
Copy link
Member Author

aargh same here: I was looking into CDSE integration tests that uses cube.execute_batch(title=... and couldn't understand why the tile was not showing up in the job registry

fixed with #652

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants