-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Can't list deployments #2701
Conversation
- Created a migration function and modified the moduleName to be 'Fullvm' to list all old VMs with 'Fullvm' type.
- Updated the import of 'BaseModule' in 'migration.ts' to be local dir instead of the dist one to fix the un-exported issue - Flat the array of the contracts then loop over them all - Updated the moduleName after listing the 'Fullvm' to 'vm' again to list the other deployments - Pushed the newly changed contract to the 'newContracts' array to avoid the lag of gql - Updated the 'moduleName' in 'base.ts' to take 'Fullvm' if the 'moduleNames' is undefined
014e51f
to
9b0dcc5
Compare
- Removed un-needed 'await' in 'Promise.all()' - Removed un-needed 'await' in returning the 'extrinsics' - Returned the 'module.tfClient.applyAllExtrinsics<Contract>(extrinsics);' without awaiting on it - Moved the update of the moduleName to the 'migrateModule'
- Updated the import of the 'BaseModule' from '@threefold/grid_client' - Moved the update of the 'module.moduleName' to the '_migrateOldFullVMs'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I deployed multiple VMs with the type "Fullvm" from Grid client. However, none were listed in the playground.
Here's the logs:
yarn run v1.19.0
$ /home/zainab/repos/tfgrid-sdk-ts/node_modules/.bin/ts-node --project tsconfig-node.json scripts/single_vm.ts
Credentials not all found in env variables. Loading all credentials from default config.json...
2024-05-16 12:51:02 API/INIT: RPC methods not decorated: chainHead_unstable_body, chainHead_unstable_call, chainHead_unstable_follow, chainHead_unstable_genesisHash, chainHead_unstable_header, chainHead_unstable_stopBody, chainHead_unstable_stopCall, chainHead_unstable_stopStorage, chainHead_unstable_storage, chainHead_unstable_unfollow, chainHead_unstable_unpin, transaction_unstable_submitAndWatch, transaction_unstable_unwatch
2024-05-16 12:51:02 API/INIT: Not decorating runtime apis without matching versions: TransactionPaymentApi/4 (1 known), Metadata/2 (1 known)
Start creating the machine deployment with name newVMS3
Adding node 171 to network wedtest
Node 171 reserved ports: [2437,9944,9945,22309,443,8082,25890,20225,5451,9943,300,80,20606]
Generating peers for network wedtest
Creating a vm on node: 171, network: wedtest with private ip: 10.249.2.2
Merging workloads
Updating network workload with name: wedtest
Deploying on node_id: 171
Deploying on node_id: 171
Lock acquired
2024-05-16 12:51:33 API/INIT: Not decorating runtime apis without matching versions: TransactionPaymentApi/4 (1 known), Metadata/2 (1 known)
phase: {"applyExtrinsic":2}, section: balances, method: Withdraw, data: ["5GNU4aqL9JPj79hUDyPrPPTCpaMcd3LRAmyXvvWUZYtNcLZb",10354]
phase: {"applyExtrinsic":2}, section: smartContractModule, method: ContractCreated, data: [{"version":4,"state":{"created":null},"contractId":110532,"twinId":89,"contractType":{"nodeContract":{"nodeId":171,"deploymentHash":"0x6435383436343137643335303433323437353562656330366337303238396263","deploymentData":"0x7b2276657273696f6e223a332c2274797065223a226e6574776f726b222c226e616d65223a2277656474657374222c2270726f6a6563744e616d65223a2246756c6c766d2f6e6577564d5333227d","publicIps":0,"publicIpsList":[]}},"solutionProviderId":null}]
phase: {"applyExtrinsic":2}, section: utility, method: ItemCompleted, data: []
phase: {"applyExtrinsic":2}, section: smartContractModule, method: ContractCreated, data: [{"version":4,"state":{"created":null},"contractId":110533,"twinId":89,"contractType":{"nodeContract":{"nodeId":171,"deploymentHash":"0x3132336339343239303032323362653433316366366137396163396262393239","deploymentData":"0x7b2276657273696f6e223a332c2274797065223a2246756c6c766d222c226e616d65223a226e6577564d5333222c2270726f6a6563744e616d65223a2246756c6c766d2f6e6577564d5333227d","publicIps":0,"publicIpsList":[]}},"solutionProviderId":null}]
phase: {"applyExtrinsic":2}, section: utility, method: ItemCompleted, data: []
phase: {"applyExtrinsic":2}, section: utility, method: BatchCompleted, data: []
phase: {"applyExtrinsic":2}, section: balances, method: Deposit, data: ["5EvbAkU2fMiWXGrAmnUTi4zdVNXTa9cpamnhakuQcSMYSnpT",10354]
phase: {"applyExtrinsic":2}, section: transactionPayment, method: TransactionFeePaid, data: ["5GNU4aqL9JPj79hUDyPrPPTCpaMcd3LRAmyXvvWUZYtNcLZb",10354,0]
phase: {"applyExtrinsic":2}, section: system, method: ExtrinsicSuccess, data: [{"weight":{"refTime":2598704399,"proofSize":8666},"class":"Normal","paysFee":"Yes"}]
Lock released
Sending deployment to node_id: 171
A deployment has been created on node_id: 171 with contract_id: 110532
Sending deployment to node_id: 171
A deployment has been created on node_id: 171 with contract_id: 110533
Waiting for deployment with contract_id: 110532 to be ready
Waiting for deployment with contract_id: 110533 to be ready
2024-05-16 12:51:44 API/INIT: Not decorating runtime apis without matching versions: TransactionPaymentApi/4 (1 known), Metadata/2 (1 known)
'================= Deploying VM ================='
{
contracts: {
created: [
{
version: 4,
state: { created: null },
contractId: 110533,
twinId: 89,
contractType: {
nodeContract: {
nodeId: 171,
deploymentHash: '123c942900223be431cf6a79ac9bb929',
deploymentData: '{"version":3,"type":"Fullvm","name":"newVMS3","projectName":"Fullvm/newVMS3"}',
publicIps: 0,
publicIpsList: []
}
},
solutionProviderId: null
}
],
updated: [],
deleted: []
},
wireguard_config: ''
}
'================= Deploying VM ================='
'================= Getting deployment information ================='
[]
'================= Getting deployment information ================='
Waiting for the rmb responses to be received before closing the connection
disconnecting
Done in 81.11s.
I deleted the first 2 VMs but you can search for the last contract.
…ame to '{project Name}' instead of '{project Name/deployment_name}'.
…cts' method with some improvements: - Replaced the 'exact' search with 'contains' algo by adding 'includes' when searching on the 'projectName'. - Introduced a new field 'updatedAt' in the 'GqlNodeContract' type to store the updated time in it. - Added a condition on checking on the 'updatedAt' field to replace the newly added contract with the Gql contract.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job, Emad!
Description
Created a migration function and modified the moduleName to be 'Fullvm' to list all old VMs with 'Fullvm' type.
Changes
Related Issues
List of related issues
Screenshots
Checklist