public static Optional<JobResourceRequirements> readFromJobGraph(JobGraph jobGraph)
            throws IOException {
        try {
            return Optional.ofNullable(
                    InstantiationUtil.readObjectFromConfig(
                            jobGraph.getJobConfiguration(),
                            JOB_RESOURCE_REQUIREMENTS_KEY,
                            JobResourceRequirements.class.getClassLoader()));
        } catch (ClassNotFoundException e) {
            throw new IOException(
                    "Unable to deserialize JobResourceRequirements due to missing classes. This might happen when the JobGraph was written from a different Flink version.",
                    e);
        }
    }
@Test
    void testReadNonExistentResourceRequirementsFromJobGraph() throws IOException {
        assertThat(JobResourceRequirements.readFromJobGraph(JobGraphTestUtils.emptyJobGraph()))
                .isEmpty();
    }