<commit_before>import {Pool} from 'threads';
import { scaleLog, scaleLinear } from 'd3-scale';
import { range } from 'd3-array';
import {
  json as d3Json,
  text as d3Text,
  request,
} from 'd3-request';
import slugid from 'slugid';

import {
  workerGetTiles,
  workerFetchTiles,
  workerSetPix,
  tileResponseToData,
} from '../worker';

const MAX_FETCH_TILES = 20;

const setPixPool = new Pool(1);
setPixPool.run(function(params, done) {
  try {
    const array = new Float32Array(params.data);
    const pixData = worker.workerSetPix(
      params.size,
      array,
      params.valueScaleType,
      params.valueScaleDomain,
      params.pseudocount,
      params.colorScale,
    );

    done.transfer({
      pixData: pixData
    }, [pixData.buffer]);
  } catch (err) {
    console.log('err:', err);
  }
}, ['http://localhost:8080/worker.js']);

const fetchTilesPool = new Pool(10);
fetchTilesPool.run(function(params, done) {
  try {
    worker.workerGetTiles(params.outUrl, params.server, params.theseTileIds, params.authHeader, done);
    /*
    done.transfer({
      pixData: pixData
    }, [pixData.buffer]);
    */
  } catch (err) {
    console.log('err:', err);
  }
}, ['http://localhost:8080/worker.js']);


import pubSub from './pub-sub';

import { trimTrailingSlash as tts } from '../utils';

// Config
import { TILE_FETCH_DEBOUNCE } from '../configs';

const sessionId = slugid.nice();
export let requestsInFlight = 0; // eslint-disable-line import/no-mutable-exports
export let authHeader = null;

const debounce = (func, wait) => {
  let timeout;
  let bundledRequest = [];
  let requestMapper = {};
<commit_msg>Specify worker as an absolute path<commit_after>import {Pool} from 'threads';
import { scaleLog, scaleLinear } from 'd3-scale';
import { range } from 'd3-array';
import {
  json as d3Json,
  text as d3Text,
  request,
} from 'd3-request';
import slugid from 'slugid';

import {
  workerGetTiles,
  workerFetchTiles,
  workerSetPix,
  tileResponseToData,
} from '../worker';

const MAX_FETCH_TILES = 20;

const str = document.currentScript.src
const pathName = str.substring(0, str.lastIndexOf("/"));
const workerPath = `${pathName}/worker.js`;

const setPixPool = new Pool(1);

setPixPool.run(function(params, done) {
  try {
    const array = new Float32Array(params.data);
    const pixData = worker.workerSetPix(
      params.size,
      array,
      params.valueScaleType,
      params.valueScaleDomain,
      params.pseudocount,
      params.colorScale,
    );

    done.transfer({
      pixData: pixData
    }, [pixData.buffer]);
  } catch (err) {
    console.log('err:', err);
  }
}, [workerPath]);


const fetchTilesPool = new Pool(10);
fetchTilesPool.run(function(params, done) {
  try {
    worker.workerGetTiles(params.outUrl, params.server, params.theseTileIds, params.authHeader, done);
    /*
    done.transfer({
      pixData: pixData
    }, [pixData.buffer]);
    */
  } catch (err) {
    console.log('err:', err);
  }
}, [workerPath]);


import pubSub from './pub-sub';

import { trimTrailingSlash as tts } from '../utils';

// Config
import { TILE_FETCH_DEBOUNCE } from '../configs';

const sessionId = slugid.nice();
export let requestsInFlight = 0; // eslint-disable-line import/no-mutable-exports
export let authHeader = null;

const debounce = (func, wait) => {
  let timeout;
  let bundledRequest = [];
  let requestMapper = {};

{'fraction_non_alphanumeric': 0.14294152392203188, 'fraction_numerical': 0.010336680448907265, 'mean_word_length': 3.509986684420772, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '503313', 'n_tokens_mistral': 1180, 'n_tokens_neox': 1133, 'n_words': 265}