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

Boto3 update and create job api calls when adding additional default arguments, the new job parameters do not get reflected in the UI #4266

Open
portswigger-katie opened this issue Sep 11, 2024 · 1 comment
Assignees
Labels
bug This issue is a confirmed bug. glue p3 This is a minor priority issue

Comments

@portswigger-katie
Copy link

Describe the bug

I have a python script that creates and updates glue jobs.
If it detects additional arguments ( job parameters) it appends these to the default arguments of the job.

In the AWS console the 'job run input arguments' part of the UI reflects the new job parameters but the 'job detail' is failing to show them in the UI in 'job parameters' under 'Advanced properties'
Screenshot 2024-09-11 at 10 19 00

Expected Behavior

I would expect In the AWS console the 'job run' part of the UI to reflect the new job parameters.

Current Behavior

The UI does not reflect the new job parameters.
There are no errors as the api calls are succeeding.

Reproduction Steps

    job_name: str,
    role: str,
    script_location: str,
    temp_dir: str,
    extra_py_files: str,
    config: dict,
    glue_client,
) -> dict[str, Any]:
    """Create or update an AWS Glue job."""
    print(config.get("library-set"))

    # Initialize the common job_params dictionary
    job_params = {
        "Description": config.get("job_description", "Job created by GitHub Actions"),
        "Role": role,
        "ExecutionProperty": {
            "MaxConcurrentRuns": config.get("max_concurrent_runs", 1)
        },
        "Command": {
            "Name": config.get("command_name", "glueetl"),
            "ScriptLocation": script_location,
            "PythonVersion": config.get("python_version", "3"),
        },
        "DefaultArguments": {
            "--extra-py-files": extra_py_files,
            "--enable-job-insights": str(
                config.get("enable_job_insights", True)
            ).lower(),
            "--job-language": "python",
            "--TempDir": temp_dir,
            "--enable-auto-scaling": str(
                config.get("enable_auto_scaling", True)
            ).lower(),
            "--enable-glue-datacatalog": str(
                config.get("enable-glue-datacatalog", False)
            ).lower(),
        },
        "MaxRetries": config.get("max_retries", 0),
        "Timeout": config.get("timeout_minutes", 120),
        "NumberOfWorkers": int(config.get("number_of_workers", 10)),
        "GlueVersion": str(config.get("glue_version", "4.0")),
        "WorkerType": config.get("worker_type", "G.1X"),
        "ExecutionClass": config.get("execution_class", "STANDARD"),
    }

    # Add library-set if it exists in the config
    if config.get("library-set"):
        job_params["DefaultArguments"]["library-set"] = str(
            config["library-set"]
        ).lower()

    connections = config.get("connections")
    if connections:
        job_params["Connections"] = {"Connections": connections}

    try:
        glue_client.get_job(JobName=job_name)
        logger.info(f"Glue job '{job_name}' exists. Updating it.")
        glue_client.update_job(JobName=job_name, JobUpdate=job_params)
        logger.info(f"Glue job '{job_name}' updated successfully.")

    except glue_client.exceptions.EntityNotFoundException:
        logger.info(f"Glue job '{job_name}' does not exist. Creating it.")
        glue_client.create_job(Name=job_name, **job_params)
        logger.info(f"Glue job '{job_name}' created successfully.")
    except Exception as e:
        logger.error(f"Error creating or updating Glue job '{job_name}': {e}")
        sys.exit(1)

Possible Solution

When theses api calls are made in addition to updating the 'Job run input arguments' also update the 'Job parameters' in the job detail section of the UI.

Additional Information/Context

boto3
aws-glue-sessions
aws-glue-libs @ git+https://github.com/awslabs/[email protected]
botocore

SDK version used

boto3 1.35.16

Environment details (OS name and version, etc.)

Python 3.11.4 on MACOS 14.6.1

@portswigger-katie portswigger-katie added bug This issue is a confirmed bug. needs-triage This issue or PR still needs to be triaged. labels Sep 11, 2024
@adev-code adev-code self-assigned this Sep 11, 2024
@adev-code adev-code added investigating This issue is being investigated and/or work is in progress to resolve the issue. glue p3 This is a minor priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Sep 11, 2024
@adev-code
Copy link

Hi @portswigger-katie, thanks for reaching out. I have replicated the issue using both the SDK and AWS Console. I created a Job with parameters and the parameters do not stay in the "Job Parameters" UI. The fact that this occurs using just the console suggests that this isn't an SDK issue. I have reached out to Glue service team about if this is expected behavior or not.

I'll let you know when I have any updates. Thanks!

Ticket # for internal use : P154609298

@adev-code adev-code removed the investigating This issue is being investigated and/or work is in progress to resolve the issue. label Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a confirmed bug. glue p3 This is a minor priority issue
Projects
None yet
Development

No branches or pull requests

2 participants