A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/ns__affinity_8cpp_source.html below:

NCBI C++ ToolKit: src/app/netschedule/ns_affinity.cpp Source File

53

m_WNClientsOpCount(0),

54

m_ReaderClientsOpCount(0),

55

m_WaitGetClientsOpCount(0),

56

m_WaitReadClientsCount(0)

140  size_t

max_records)

const 151  size_t

max_records)

const 157  size_t

new_aff_count = 0;

158  for

(vector<string>::const_iterator k = aff_tokens.begin();

159

k != aff_tokens.end(); ++k)

169  if

(aff_token.empty())

173  map

<

const string

*,

180  return

affinity->second;

194  return

*(found->second.m_AffToken);

202  unsigned int

client_id,

211  map

<

const string

*,

216  unsigned int

aff_id = found->second;

222

jobs_affinity->second.AddJob(job_id);

225  x_AddClient

(jobs_affinity->second, client_id, cmd_group);

239  string

* new_token =

new string

(token);

246

new_job_affinity.

AddJob

(job_id);

249  x_AddClient

(new_job_affinity, client_id, cmd_group);

269

vector<unsigned int> & aff_ids)

271  if

(!tokens.empty()) {

272

aff_ids.reserve(tokens.size());

273  for

(list<string>::const_iterator k(tokens.begin());

274

k != tokens.end(); ++k) {

277

resolved_affs.

set_bit

(aff_id,

true

);

278

aff_ids.push_back(aff_id);

290  map

<

const string

*,

294  return

found->second;

306  string

* new_token =

new string

(token);

332  return

found->second.m_Jobs;

346  for

( ; en.

valid

(); ++en) {

349

jobs |= found->second.m_Jobs;

368  if

(job_id == 0 || aff_id == 0)

379

found->second.RemoveJob(job_id);

380  if

(found->second.CanBeDeleted())

402  unsigned int

client_id,

416  if

(client_id == 0 || aff_id == 0)

435  if

(client_id == 0 || !aff_ids.

any

())

440  for

( ; en.

valid

(); ++en) {

451  unsigned int

client_id,

456  if

(client_id == 0 || !aff_ids.

any

())

459  size_t

del_count = 0;

463  for

( ; en.

valid

(); ++en) {

475  if

(found->second.CanBeDeleted()) {

488  unsigned int

client_id,

492  if

(client_id == 0 || !aff_ids.

any

())

498  for

( ; en.

valid

(); ++en) {

513  const string

& scope,

523  while

(en.

valid

()) {

527  if

(batch.

count

() >= batch_size) {

535  if

(batch.

count

() > 0)

548  const string

& scope,

558  if

(batch[k->first]) {

560

queue, clients_registry,

563  if

(printed >= batch.

count

())

577  const string

& scope,

588  else if

(!scope.empty()) {

595  buffer

+=

"OK:AFFINITY: '"

+

597  "OK: ID: "

+ to_string(aff_id) +

"\n"

;

604  for

( ; en.

valid

(); ++en) {

605  unsigned int

job_id = *en;

612  buffer

+=

"OK: JOBS: NONE\n"

;

615  buffer

+=

"OK: NUMBER OF JOBS: "

+ to_string(jobs.

count

()) +

"\n"

;

619  buffer

+=

"OK: WN CLIENTS (PREFERRED):\n"

;

622  for

( ; en.

valid

(); ++en)

627  buffer

+=

"OK: WN CLIENTS (PREFERRED): NONE\n"

;

630  buffer

+=

"OK: NUMBER OF WN CLIENTS (PREFERRED): "

+

635  buffer

+=

"OK: READER CLIENTS (PREFERRED):\n"

;

638

m_ReaderClients.first());

639  for

( ; en.

valid

(); ++en)

644  buffer

+=

"OK: READER CLIENTS (PREFERRED): NONE\n"

;

647  buffer

+=

"OK: NUMBER OF READER CLIENTS (PREFERRED): "

+

652  buffer

+=

"OK: CLIENTS (EXPLICIT WGET):\n"

;

655

m_WaitGetClients.first());

656  for

( ; en.

valid

(); ++en)

661  buffer

+=

"OK: CLIENTS (EXPLICIT WGET): NONE\n"

;

664  buffer

+=

"OK: NUMBER OF CLIENTS (EXPLICIT WGET): "

+

669  buffer

+=

"OK: CLIENTS (EXPLICIT READ):\n"

;

672

m_WaitReadClients.first());

673  for

( ; en.

valid

(); ++en)

678  buffer

+=

"OK: CLIENTS (EXPLICIT READ): NONE\n"

;

681  buffer

+=

"OK: NUMBER OF CLIENTS (EXPLICIT READ): "

+

699  throw

runtime_error(

"Error while restoring jobs from the dump. " 700  "The affinity with id "

+ to_string(aff_id) +

701  " is not found in the loaded dictionary." 702  " (Lost affinity dictionary dump?)"

);

704

found->second.AddJob(job_id);

718  unsigned int

max_aff_id = 0;

723  if

(candidate->first > max_aff_id)

726

max_aff_id = candidate->first;

728  if

(candidate->second.CanBeDeleted()) {

742  unsigned int

del_count = 0;

746  for

( ; en.

valid

(); ++en) {

747  unsigned int

aff_id = *en;

756  if

(found->second.CanBeDeleted()) {

759  if

(del_count >= max_to_del)

770  unsigned int

still_candidate = 0;

774  for

( ; en.

valid

(); ++en) {

775  unsigned int

aff_id = *en;

784  if

(found->second.CanBeDeleted())

789  return

still_candidate;

800  delete

jobs_affinity->second.m_AffToken;

814  map

<

const string

*,

817

found_aff->second.m_AffToken);

821  delete

found_aff->second.m_AffToken;

842  unsigned int

client_id,

860  unsigned int

client_id,

878  unsigned int

client_id,

896  unsigned int

client_id,

914  const string

& qname)

const 922  if

(k->second.m_Jobs.any())

923

affs_to_dump.

set_bit

(k->first);

926  if

(!affs_to_dump.

any

())

930

FILE * aff_dict_file = fopen(aff_dict_file_name.c_str(),

"wb"

);

932  if

(aff_dict_file ==

NULL

)

933  throw

runtime_error(

"Cannot open file "

+ aff_dict_file_name +

934  " to dump affinities"

);

937

setbuf(aff_dict_file,

NULL

);

943

header.

Write

(aff_dict_file);

944

}

catch

(

const

exception & ex) {

945

fclose(aff_dict_file);

946  throw

runtime_error(

"Writing error while dumping affinities: "

+

951  for

( ; en.

valid

(); ++en) {

955  const string

& token = *(aff_it->second.m_AffToken);

960

memcpy(aff_dump.

token

, token.data(), token.size());

963

aff_dump.

Write

(aff_dict_file);

964

}

catch

(

const

exception & ex) {

965

fclose(aff_dict_file);

966  throw

runtime_error(

"Writing error while dumping affinities: "

+

971

fclose(aff_dict_file);

976  const string

& qname)

const 979  if

(access(aff_dict_file_name.c_str(), F_OK) != -1)

980  remove

(aff_dict_file_name.c_str());

985  const string

& qname)

const 987  const string

fname(

"aff_dict_dump."

);

988  string

upper_queue_name = qname;

990  return

dump_dir_name + fname + upper_queue_name;

1002  const string

& qname)

1004  if

(!

CDir

(dump_dir_name).Exists())

1008  if

(!

CFile

(aff_dict_file_name).Exists())

1011

FILE * aff_dict_file = fopen(aff_dict_file_name.c_str(),

"rb"

);

1012  if

(aff_dict_file ==

NULL

)

1013  throw

runtime_error(

"Cannot open file "

+ aff_dict_file_name +

1014  " to load dumped affinities"

);

1017

header.

Read

(aff_dict_file);

1020  while

(aff_dump.

Read

(aff_dict_file, header.

fixed_size

) == 0) {

1021  string

* new_token =

new string

(aff_dump.

token

,

1032

}

catch

(

const

exception & ex) {

1033

fclose(aff_dict_file);

1035  throw

runtime_error(

"Reading error while loading dumped affinities: "

+

1036  string

(ex.what()));

1039

fclose(aff_dict_file);

void RemoveJobFromAffinity(unsigned int job_id, unsigned int aff_id)

void SetWaitClientForAffinities(unsigned int client_id, const TNSBitVector &aff_ids, ECommandGroup cmd_group)

void x_AddClient(SNSJobsAffinity &aff_data, unsigned int client_id, ECommandGroup command_group)

unsigned int ResolveAffinity(const string &token)

unsigned int m_LastAffinityID

TNSBitVector GetJobsWithAffinity(unsigned int aff_id) const

void AddClientToAffinities(unsigned int client_id, const TNSBitVector &aff_ids, ECommandGroup cmd_group)

void Dump(const string &dump_dir_name, const string &queue_name) const

size_t RemoveClientFromAffinities(unsigned int client_id, const TNSBitVector &aff_ids, ECommandGroup cmd_group)

void AddClientToAffinity(unsigned int client_id, unsigned int aff_id, ECommandGroup cmd_group)

void FinalizeAffinityDictionaryLoading(void)

TNSBitVector GetJobsWithAffinities(const TNSBitVector &affs) const

void RemoveDump(const string &dump_dir_name, const string &queue_name) const

string x_PrintSelected(const TNSBitVector &batch, const CQueue *queue, const CNSClientsRegistry &clients_registry, const TNSBitVector &scope_jobs, const string &scope, bool verbose) const

void x_RemoveClient(SNSJobsAffinity &aff_data, unsigned int client_id, ECommandGroup command_group)

bool CanAccept(const string &aff_token, size_t max_records) const

string Print(const CQueue *queue, const CNSClientsRegistry &clients_registry, const TNSBitVector &scope_jobs, const string &scope, size_t batch_size, bool verbose) const

string GetTokenByID(unsigned int aff_id) const

size_t x_RemoveClientFromAffinities(unsigned int client_id, const TNSBitVector &aff_ids, bool is_wait_client, ECommandGroup cmd_group)

void ResolveAffinities(const list< string > &tokens, TNSBitVector &resolved_affs, vector< unsigned int > &aff_ids)

void x_AddWaitClient(SNSJobsAffinity &aff_data, unsigned int client_id, ECommandGroup command_group)

TNSBitVector GetRegisteredAffinities(void) const

map< unsigned int, SNSJobsAffinity > m_JobsAffinity

unsigned int CollectGarbage(unsigned int max_to_del)

void x_RemoveWaitClient(SNSJobsAffinity &aff_data, unsigned int client_id, ECommandGroup command_group)

void LoadFromDump(const string &dump_dir_name, const string &queue_name)

unsigned int GetIDByToken(const string &aff_token) const

map< const string *, unsigned int, SNSTokenCompare > m_AffinityIDs

void x_InitLastAffinityID(unsigned int value)

string x_GetDumpFileName(const string &dump_dir_name, const string &qname) const

unsigned int CheckRemoveCandidates(void)

unsigned int ResolveAffinityToken(const string &token, unsigned int job_id, unsigned int client_id, ECommandGroup command_group)

TNSBitVector m_RegisteredAffinities

void AddJobToAffinity(unsigned int job_id, unsigned int aff_id)

unsigned int x_GetNextAffinityID(void)

TNSBitVector m_RemoveCandidates

size_t RemoveWaitClientFromAffinities(unsigned int client_id, const TNSBitVector &aff_ids, ECommandGroup cmd_group)

void x_DeleteAffinity(unsigned int aff_id, map< unsigned int, SNSJobsAffinity >::iterator found_aff)

CFastMutex m_LastAffinityIDLock

string x_PrintOne(unsigned int aff_id, const SNSJobsAffinity &jobs_affinity, const CQueue *queue, const CNSClientsRegistry &clients_registry, const TNSBitVector &scope_jobs, const string &scope, bool verbose) const

string GetNodeName(unsigned int id) const

string MakeJobKey(unsigned int job_id) const

TJobStatus GetJobStatus(unsigned job_id) const

Constant iterator designed to enumerate "ON" bits.

bool valid() const noexcept

Checks if iterator is still valid.

Bitvector Bit-vector container with runtime compression of bits.

@ opt_free_0

Free unused 0 blocks.

bool any() const noexcept

Returns true if any bits in this bitset are set, and otherwise returns false.

void optimize(bm::word_t *temp_block=0, optmode opt_mode=opt_compress, statistics *stat=0)

Optimize memory bitvector's memory allocation.

bool set_bit(size_type n, bool val=true)

Sets bit n.

enumerator first() const

Returns enumerator pointing on the first non-zero bit.

void clear(const size_type *ids, size_type ids_size, bm::sort_order so=bm::BM_UNKNOWN)

clear list of bits in this bitset

size_type count() const noexcept

population count (count of ON bits)

const_iterator begin() const

const_iterator end() const

const_iterator find(const key_type &key) const

Include a standard set of the NCBI C++ Toolkit most basic headers.

static void DLIST_NAME() remove(DLIST_LIST_TYPE *list, DLIST_TYPE *item)

EJobStatus

Job status codes.

static string StatusToString(EJobStatus status)

Printable status type.

#define END_NCBI_SCOPE

End previously defined NCBI scope.

#define BEGIN_NCBI_SCOPE

Define ncbi namespace.

static string PrintableString(const CTempString str, TPrintableMode mode=fNewLine_Quote|fNonAscii_Passthru)

Get a printable version of the specified string.

static string & ToUpper(string &str)

Convert string to upper case – string& version.

@ BM_GAP

GAP compression is ON.

unsigned int

A callback function used to compare two keys in a database.

NetSchedule job status tracker.

const GenericPointer< typename T::ValueType > T2 value

const size_t k_OpLimitToOptimize

const string kNoScopeOnly

const TNSBitVector kEmptyBitVector

int Read(FILE *f, size_t fixed_size_from_header)

char token[kNetScheduleMaxDBDataSize]

void RemoveReadWaitClient(unsigned int client_id)

void AddReaderClient(unsigned int client_id)

size_t m_WaitGetClientsOpCount

size_t m_WNClientsOpCount

void AddJob(unsigned int job_id)

size_t m_WaitReadClientsCount

void RemoveWNWaitClient(unsigned int client_id)

void x_ReaderClientsOp(void)

void RemoveWNClient(unsigned int client_id)

size_t m_ReaderClientsOpCount

void AddReadWaitClient(unsigned int client_id)

const string * m_AffToken

void AddWNWaitClient(unsigned int client_id)

TNSBitVector m_ReaderClients

void AddWNClient(unsigned int client_id)

bool CanBeDeleted(void) const

TNSBitVector m_WaitGetClients

TNSBitVector m_WaitReadClients

void RemoveReaderClient(unsigned int client_id)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4