Skip to content

Commit

Permalink
Registration process changes
Browse files Browse the repository at this point in the history
Add the necessary gpu field for edge device registration
  • Loading branch information
atsag committed Dec 6, 2024
1 parent 1cb3d48 commit 0dc58ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public static String get_device_deregistration_json(Device device){
return root_json_object.toJSONString();
}

public static String get_device_registration_json(String internal_ip_address, String external_ip_address, int external_access_port, String os_family, String os_architecture, String jar_url, int os_version, int cpu_cores, long ram_gb, long disk_gb, String device_name,Double price, String provider_id, String city_name, String country_name, String device_username, String device_password, String private_key, double device_longitude, double device_latitude) {
public static String get_device_registration_json(String internal_ip_address, String external_ip_address, int external_access_port, String os_family, String os_architecture, String jar_url, int os_version, int cpu_cores, long ram_gb, long disk_gb, int number_of_gpus, String device_name,Double price, String provider_id, String city_name, String country_name, String device_username, String device_password, String private_key, double device_longitude, double device_latitude) {

JSONObject root_json_object = new JSONObject();
JSONObject loginCredential = new JSONObject();
Expand Down Expand Up @@ -186,6 +186,7 @@ public static String get_device_registration_json(String internal_ip_address, St
nodeProperties.put("ram", ram_gb);
nodeProperties.put("disk", disk_gb);
nodeProperties.put("price", price);
nodeProperties.put("gpu", number_of_gpus);
nodeProperties.put("operatingSystem", operatingSystem);
nodeProperties.put("geoLocation", geoLocation);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public String register(Device device) {
String device_name = device.getRef();
Double price = device.getPrice();

int number_of_gpus = 0;
int cores = Integer.parseInt(device_info.get("CPU_PROCESSORS"));
long ram_mb = Math.round(Integer.parseInt(device_info.get("RAM_TOTAL_KB"))*1.0/1000);
long disk_mb = Math.round(Integer.parseInt(device_info.get("DISK_TOTAL_KB"))*1.0/1000);
Expand Down Expand Up @@ -121,7 +122,7 @@ public String register(Device device) {
//register_device_message.put("timestamp",(int)(clock.millis()/1000));


String register_device_message_string = get_device_registration_json(internal_ip,external_ip_address,external_access_port,os_family,os_architecture,jar_url,os_version,cores,ram_mb,disk_mb,device_name,price,provider_id,city_name,country_name, device_username, device_password,private_key,device_longitude, device_latitude);
String register_device_message_string = get_device_registration_json(internal_ip,external_ip_address,external_access_port,os_family,os_architecture,jar_url,os_version,cores,ram_mb,disk_mb,number_of_gpus,device_name,price,provider_id,city_name,country_name, device_username, device_password,private_key,device_longitude, device_latitude);
log.info("topic is {}", get_registration_topic_name(application_name));
log.info("broker ip is {}", processorProperties.getNebulous_broker_ip_address());
log.info("broker port is {}", processorProperties.getNebulous_broker_port());
Expand Down

0 comments on commit 0dc58ee

Please sign in to comment.