schedulerapache-stormapache-storm-topology

Apache Storm problem with metadata scheduler


I try to write a scheduler in Apache Storm using meta tags to schedule specific tasks to specific supervisors. I used the following code in the storm.yaml file of the supervisor 1:

supervisor.scheduler.meta:
name: 1

and while running the following part of code:

Collection<SupervisorDetails> supervisors = cluster.getSupervisors().values();
SupervisorDetails specialSupervisor = null;
for (SupervisorDetails supervisor : supervisors) {
                
     @SuppressWarnings("unchecked")
     Map<String, Object> meta = (Map<String, Object>) supervisor.getSchedulerMeta();
     System.out.println("Supervisor meta is: " + meta);             
     System.out.println("Supervisor's name is: " + meta.get("name"));
                        
     Integer gid = (Integer)meta.get("name");
                        
     if (gid==1) {
                  
     specialSupervisor = supervisor;
     System.out.println("Your supervisor is found");
     break;
     }

}

The only message I get is "Supervisor meta is: null". I tried to change several things but I cannot retrieve my supervisors metas. It always gets null. Any thoughts?

Thank you in advance. Nicole


Solution

  • 3 spaces should be added before "name" in supervisor's storm.yaml file.