-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: revert add node gpu status (#761)
- Loading branch information
Showing
13 changed files
with
198 additions
and
354 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# 14. Untrack GPU status on a node | ||
|
||
Date: 2023-06-22 | ||
|
||
## Status | ||
|
||
Accepted | ||
|
||
## Context | ||
|
||
See [here](https://github.com/threefoldtech/tfchain/issues/759) for more details. | ||
|
||
## Decision | ||
|
||
Since we don't want to store non-essential data on chain and GPU information is not of any actual value to the chain or minting, the storage map `NodeGpuStatus` (see ./0012-track-node-gpu.md) is removed from `pallet-tfgrid`. | ||
An off chain indexer will handle a node query to fetch further detailed information about nodes GPU (number / models / memory capacity / ...). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ pub mod v12; | |
pub mod v13; | ||
pub mod v14; | ||
//pub mod v15; | ||
pub mod v16; |
45 changes: 45 additions & 0 deletions
45
substrate-node/pallets/pallet-tfgrid/src/migrations/v16.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
use crate::*; | ||
use frame_support::{ | ||
traits::{OnRuntimeUpgrade, PalletInfoAccess}, | ||
weights::Weight, | ||
}; | ||
use log::info; | ||
use sp_core::Get; | ||
use sp_std::marker::PhantomData; | ||
|
||
pub struct KillNodeGpuStatus<T: Config>(PhantomData<T>); | ||
|
||
impl<T: Config> OnRuntimeUpgrade for KillNodeGpuStatus<T> { | ||
fn on_runtime_upgrade() -> Weight { | ||
if PalletVersion::<T>::get() == types::StorageVersion::V15Struct { | ||
info!(" >>> Kill NodeGpuStatus storage..."); | ||
|
||
let res = frame_support::migration::clear_storage_prefix( | ||
<Pallet<T>>::name().as_bytes(), | ||
b"NodeGpuStatus", | ||
b"", | ||
None, | ||
None, | ||
); | ||
|
||
log::info!( | ||
"Cleared '{}' entries from 'NodeGpuStatus' storage prefix", | ||
res.unique | ||
); | ||
|
||
if res.maybe_cursor.is_some() { | ||
log::error!("Storage prefix 'NodeGpuStatus' is not completely cleared."); | ||
} | ||
|
||
// Update pallet storage version | ||
PalletVersion::<T>::set(types::StorageVersion::V16Struct); | ||
info!(" <<< NodeGpuStatus killing success, storage version upgraded"); | ||
|
||
// Return the weight consumed by the migration. | ||
T::DbWeight::get().reads_writes(0, res.unique as u64 + 1) | ||
} else { | ||
info!(" >>> Unused TFGrid pallet V16 migration"); | ||
Weight::zero() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.