From fbdcd5b224683f3ae08d2209fa14455452d90a67 Mon Sep 17 00:00:00 2001 From: Minecon724 Date: Mon, 29 Jul 2024 12:18:23 +0200 Subject: [PATCH] split things, add a rented instance class will fix errors later --- .../eu/m724/vastapp/vastai/data/Instance.kt | 16 ------- .../eu/m724/vastapp/vastai/data/Machine.kt | 3 ++ .../eu/m724/vastapp/vastai/data/Pricing.kt | 20 +++++++++ .../vastapp/vastai/data/RentedInstance.kt | 45 +++++++++++++++++++ 4 files changed, 68 insertions(+), 16 deletions(-) create mode 100644 app/src/main/java/eu/m724/vastapp/vastai/data/Pricing.kt create mode 100644 app/src/main/java/eu/m724/vastapp/vastai/data/RentedInstance.kt diff --git a/app/src/main/java/eu/m724/vastapp/vastai/data/Instance.kt b/app/src/main/java/eu/m724/vastapp/vastai/data/Instance.kt index 587b663..288b244 100644 --- a/app/src/main/java/eu/m724/vastapp/vastai/data/Instance.kt +++ b/app/src/main/java/eu/m724/vastapp/vastai/data/Instance.kt @@ -19,22 +19,6 @@ data class Instance( /** "Deep Learning Performance", it's very specific like 15.679831880208411 */ val dlPerf: Double, - /** dollars per hour excluding storage costs, like 0.32 */ - val dphBase: Double, - /** storage cost 1 GB / 30 days (720 hours) - * to get hourly, divide it by 720 and multiply by GBs */ - val storageCostGbMo: Double, - /** dollars per 1 GB of download (on site it shows TB as 1024) **/ - val inetDownCostGb: Double, - /** dollars per 1 GB of upload (on site it shows TB as 1024) **/ - val inetUpCostGb: Double, - - /** if you're bidding this instance, always false in marketplace (or not?) */ - val isBid: Boolean, - /** the minimum bid you can make, as dph - * website shows more I don't know why */ - val minBid: Double, - /** since when the instance is available for rental in unix seconds * if rented by you, it's since when the machine is rented * at least I think because it's recent and unavailable machines don't have that */ diff --git a/app/src/main/java/eu/m724/vastapp/vastai/data/Machine.kt b/app/src/main/java/eu/m724/vastapp/vastai/data/Machine.kt index 2a6c523..ad0d39a 100644 --- a/app/src/main/java/eu/m724/vastapp/vastai/data/Machine.kt +++ b/app/src/main/java/eu/m724/vastapp/vastai/data/Machine.kt @@ -23,6 +23,8 @@ data class Machine( val cpuCores: Int, /** readable cpu name like xeon something */ val cpuName: String, + /** only when viewing a not rented instance */ + val cpuGhz: Double, /** disk bandwidth in MB/s (TODO find out) like 1225.1 */ val diskBandwidth: Double, @@ -81,6 +83,7 @@ data class Machine( json.getString("cpu_arch"), json.getInt("cpu_cores"), json.getString("cpu_name"), + json.optDouble("cpu_ghz", -1.0), json.getDouble("disk_bw"), json.getString("disk_name"), json.getDouble("disk_space"), diff --git a/app/src/main/java/eu/m724/vastapp/vastai/data/Pricing.kt b/app/src/main/java/eu/m724/vastapp/vastai/data/Pricing.kt new file mode 100644 index 0000000..edebac3 --- /dev/null +++ b/app/src/main/java/eu/m724/vastapp/vastai/data/Pricing.kt @@ -0,0 +1,20 @@ +package eu.m724.vastapp.vastai.data + +data class Pricing( + /** if you're bidding this instance, always false in marketplace (or not?) */ + val isBid: Boolean, + /** the minimum bid you can make, as dph + * website shows more I don't know why */ + val minBid: Double, + + /** dollars per hour excluding storage costs */ + val dphBase: Double, + /** storage cost 1 GB / 30 days (720 hours) + * to get hourly, divide it by 720 and multiply by GBs TODO remove this comment */ + /** storage cost GB/hr */ + val storageCost: Double, + /** dollars per 1 GB of download (on site it shows TB as 1024 so TODO gb or gib?) **/ + val downloadCost: Double, + /** dollars per 1 GB of upload (on site it shows TB as 1024) **/ + val uploadCost: Double, +) \ No newline at end of file diff --git a/app/src/main/java/eu/m724/vastapp/vastai/data/RentedInstance.kt b/app/src/main/java/eu/m724/vastapp/vastai/data/RentedInstance.kt new file mode 100644 index 0000000..8918057 --- /dev/null +++ b/app/src/main/java/eu/m724/vastapp/vastai/data/RentedInstance.kt @@ -0,0 +1,45 @@ +package eu.m724.vastapp.vastai.data + +import android.net.InetAddresses +import java.net.InetAddress + +data class RentedInstance( + val instance: Instance, + + /** the rental id, apparently not rented id is different */ + val rentalId: Int, + /** rented disk space in MB */ + val diskSpace: Int, + /** disk usage in MB */ + val diskUsage: Int, + /** vram usage in MB */ + val vramUsage: Int, + /** ram usage in MB */ + val memoryUsage: Int, + /** gpu utilization 0.0 - 1.0 */ + val gpuUsage: Double, + /** cpu utilization 0.0 - 1.0 */ + val cpuUsage: Double, + /** gpu temperature in celsius */ + val gpuTemperature: Double, + + /** MB downloaded in the lifetime of the instance + * there is like 20 gb added and I don't know why */ + val downloaded: Int, + /** MB downloaded in the lifetime of the instance + * this is also wrong but not as much */ + val uploaded: Int, + + /** hostname of the ssh proxy */ + val sshProxyHost: String, + val sshProxyPort: Int, + + /** the docker image that runs on the instance */ + val image: String, + /** label set by user */ + val label: String, + + /** local ip addresses? + * I think if you have another instance on the same machine you can use it */ + val localIpAddresses: List +) \ No newline at end of file