Skip to content
Snippets Groups Projects
Commit f57f6f6b authored by Anthony GRAIGNIC's avatar Anthony GRAIGNIC
Browse files

Merge branch 'modify_docker_image' into 'main'

update dockerfile to remove optimisation

See merge request !15
parents 4c230911 942502df
No related branches found
No related tags found
1 merge request!15update dockerfile to remove optimisation
Pipeline #6593 passed
......@@ -3,6 +3,7 @@ WORKDIR /app
COPY . /app
RUN cargo build --release
FROM gcr.io/distroless/cc
COPY --from=build-env /app/target/release/testnet-injector /
CMD ["./testnet-injector"]
\ No newline at end of file
FROM fedora:36
COPY --from=build-env /app/target/release/testnet-injector /target/release/
COPY --from=build-env /app/scripts /scripts/
RUN chmod +x /scripts/*.sh
#!/bin/sh
export MINER_SIGNING_KEY=4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318;
export MNEMONIC='before exclude interest push zone jealous boat ice chimney juice young side diagram silent pipe';
# MINER_SIGNING_KEY & MNEMONIC env vars are set on workstation.
# 30 mins
#TOTAL_SIMULATION_TIME=1800;
# 12 sec
# export RPC_URL=http://ecomobicoin-1.cri.local.isima.fr:8545;
# export CHAIN_ID=6363;
export RPC_URL=http://127.0.0.1:8545;
export CHAIN_ID=636363;
# ./target/release/testnet-injector simulate-bx-from-csv ../movement-data/public-transport/MF_user_mobility_june-to-august-2023_mulhouse_dataset/anonymized_june-to-august-2023_mulhouse_dataset.csv $TOTAL_SIMULATION_TIME &
# Send BX
./target/release/testnet-injector simulate-bx-from-csv ./data/anonymized_june-to-november-2023_france_dataset.csv $TOTAL_SIMULATION_TIME &
echo "TOTAL_SIMULATION_TIME = $TOTAL_SIMULATION_TIME and block time = $BLOCK_TIME"
# Mine
for ((i=1; i<=100; i++))
do
echo "MINE $i/100";
if ((i % 2 == 0)); then
export RPC_URL=$RPC_URL_MINER_1; ./target/release/testnet-injector mine
else
export RPC_URL=$RPC_URL_MINER_2; ./target/release/testnet-injector mine
fi
if [ $i -ne 100 ]; then
sleep $BLOCK_TIME
fi
done
#!/bin/bash
#!/bin/sh
export MINER_SIGNING_KEY=4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318;
# MINER_SIGNING_KEY & MNEMONIC env vars are set on workstation.
......@@ -11,12 +11,12 @@ export RPC_URL=http://127.0.0.1:8545;
export CHAIN_ID=636363;
# Mine on eco1 with `--max-block 0`
#
#
# rm -rf /home/angraign/.local/share/truite/chaindata/
# ./truite --chain-spec-file clermont-bootnode.ron --no-dns-discovery --cidr 192.168.0.0/16 --rpc-listen-address 0.0.0.0:8545 --max-block 0
# export RPC_URL=http://ecomobicoin-1.cri.local.isima.fr:8545; export CHAIN_ID=6363; ./target/release/testnet-injector mine
# ./truite --chain-spec-file clermont-bootnode.ron --no-dns-discovery --cidr 192.168.0.0/16 --rpc-listen-address 0.0.0.0:8545
#
#
# Mine
for ((i=1; i<=100; i++))
......
#!/bin/bash
#!/bin/sh
export MINER_SIGNING_KEY=4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318;
export MNEMONIC='before exclude interest push zone jealous boat ice chimney juice young side diagram silent pipe';
......@@ -14,12 +14,12 @@ export RPC_URL=http://127.0.0.1:8545;
export CHAIN_ID=636363;
# Mine on eco1 with `--max-block 0`
#
#
# rm -rf /home/angraign/.local/share/truite/chaindata/
# ./truite --chain-spec-file clermont-bootnode.ron --no-dns-discovery --cidr 192.168.0.0/16 --rpc-listen-address 0.0.0.0:8545 --max-block 0
# export RPC_URL=http://ecomobicoin-1.cri.local.isima.fr:8545; export CHAIN_ID=6363; ./target/release/testnet-injector mine
# ./truite --chain-spec-file clermont-bootnode.ron --no-dns-discovery --cidr 192.168.0.0/16 --rpc-listen-address 0.0.0.0:8545
#
#
# ./target/release/testnet-injector simulate-bx-from-csv ../movement-data/public-transport/MF_user_mobility_june-to-august-2023_mulhouse_dataset/anonymized_june-to-august-2023_mulhouse_dataset.csv $TOTAL_SIMULATION_TIME &
./target/release/testnet-injector simulate-bx-from-csv ./data/dataset-extract.csv $TOTAL_SIMULATION_TIME &
......
#!/bin/bash
#!/bin/sh
export MINER_SIGNING_KEY=4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318;
export MNEMONIC='before exclude interest push zone jealous boat ice chimney juice young side diagram silent pipe';
......@@ -29,7 +29,7 @@ do
else
export RPC_URL=$RPC_URL_MINER_2; ./target/release/testnet-injector mine
fi
if [ $i -ne 100 ]; then
sleep $BLOCK_TIME
fi
......
#!/bin/bash
#!/bin/sh
export MINER_SIGNING_KEY=4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318;
export MNEMONIC='before exclude interest push zone jealous boat ice chimney juice young side diagram silent pipe';
......
......@@ -270,14 +270,17 @@ async fn main() -> Result<(), anyhow::Error> {
.unwrap()
.as_secs();
let simulation_behavior = mobility_records[i].clone();
let relative_start_duration = mobility_records_times[i];
let relative_start_duration = if i == 0 {
Duration::from_secs(0)
}
else { mobility_records_times[i] - mobility_records_times[i - 1] };
let rpc_url = rpc_url.clone();
let chain_id = chain_id;
let mut time_since_beginning = now;
tokio::time::sleep(relative_start_duration).await;
handles.push(tokio::spawn({
async move {
tokio::time::sleep(relative_start_duration).await;
time_since_beginning += relative_start_duration.as_secs();
let provider = Provider::<Http>::try_from(rpc_url.clone()).unwrap();
......
......@@ -99,6 +99,8 @@ pub fn generate_behaviors_from_records(records: Vec<MobilityRecord>) -> Vec<Mobi
let earliest_datetime = find_earliest_mobility_record(&records);
// let dataset_id = thread_rng().gen::<u64>();
let mut start_times:Vec<i128> = records.iter().map(|r| r.created_at.sub(earliest_datetime).whole_milliseconds()).collect();
start_times.sort_unstable();
records
.iter()
......@@ -106,11 +108,11 @@ pub fn generate_behaviors_from_records(records: Vec<MobilityRecord>) -> Vec<Mobi
.map(|(i, r)| MobilityBehavior {
id: i as u64,
// dataset_id,
relative_start_time: r.created_at.sub(earliest_datetime).whole_milliseconds(),
relative_start_time: start_times[i],
quantity: quantify_mobility(r.service.clone()),
mobility_record: r.clone(),
})
.collect()
.collect::<Vec<MobilityBehavior>>()
}
/// Strech behavior start time for simulation
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment