@Override
    public void putJobResourceRequirements(
            JobID jobId, JobResourceRequirements jobResourceRequirements) throws Exception {
        synchronized (lock) {
            @Nullable final JobGraph jobGraph = recoverJobGraph(jobId);
            if (jobGraph == null) {
                throw new NoSuchElementException(
                        String.format(
                                "JobGraph for job [%s] was not found in JobGraphStore and is needed for attaching JobResourceRequirements.",
                                jobId));
            }
            JobResourceRequirements.writeToJobGraph(jobGraph, jobResourceRequirements);
            putJobGraph(jobGraph);
        }
    }
@Test
    public void testPutJobResourceRequirementsOfNonExistentJob() throws Exception {
        final TestingStateHandleStore<JobGraph> stateHandleStore =
                builder.setGetFunction(
                                ignore -> {
                                    throw new StateHandleStore.NotExistException("Does not exist.");
                                })
                        .build();
        final JobGraphStore jobGraphStore = createAndStartJobGraphStore(stateHandleStore);
        assertThrows(
                NoSuchElementException.class,
                () ->
                        jobGraphStore.putJobResourceRequirements(
                                new JobID(), JobResourceRequirements.empty()));
    }