Skip to content
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

Merged
merged 9 commits into from
May 21, 2024
Merged

Conversation

Mahmoud-Emad
Copy link
Contributor

@Mahmoud-Emad Mahmoud-Emad commented May 15, 2024

Description

Created a migration function and modified the moduleName to be 'Fullvm' to list all old VMs with 'Fullvm' type.

Changes

  • 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-

Related Issues

List of related issues

Screenshots

  • image

Checklist

  • Tests included
  • Build pass
  • Documentation
  • Code format and docstrings
  • Screenshots/Video attached (needed for UI changes)

- 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
@Mahmoud-Emad Mahmoud-Emad force-pushed the development_listing_deployment branch from 014e51f to 9b0dcc5 Compare May 15, 2024 10:18
@Mahmoud-Emad Mahmoud-Emad marked this pull request as ready for review May 15, 2024 10:18
- 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'
@Mahmoud-Emad Mahmoud-Emad self-assigned this May 16, 2024
Copy link
Contributor

@zaelgohary zaelgohary left a 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.

image

image

image

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.

@zaelgohary
Copy link
Contributor

zaelgohary commented May 16, 2024

The issue with the listing is that it works but when trying to list for the second time not the first.

The below deployments were successfully listed after I tried to list them twice not before that.

image

@Mahmoud-Emad Mahmoud-Emad marked this pull request as draft May 19, 2024 06:03
…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.
@Mahmoud-Emad Mahmoud-Emad marked this pull request as ready for review May 19, 2024 15:12
Copy link
Contributor

@zaelgohary zaelgohary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job, Emad!

@Mahmoud-Emad Mahmoud-Emad merged commit 0da6be6 into development May 21, 2024
3 checks passed
@Mahmoud-Emad Mahmoud-Emad deleted the development_listing_deployment branch May 21, 2024 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants