Ejemplo n.º 1
0
        public void emit()
        {
            StringBuilder str_builder = new StringBuilder();
            JsonWriter    jw          = new JsonWriter(str_builder);

            jw.WriteObjectStart();
            jw.WritePropertyName("command");
            jw.Write("emit");
            jw.WritePropertyName("anchors");
            jw.WriteArrayStart();
            foreach (string temp_str in anchors)
            {
                jw.Write(temp_str);
            }
            jw.WriteArrayEnd();
            jw.WritePropertyName("tuple");
            jw.WriteArrayStart();
            foreach (string temp_str in tuple)
            {
                jw.Write(temp_str);
            }
            jw.WriteArrayEnd();
            jw.WriteObjectEnd();
            string info = str_builder.ToString();

            StandardIO.sendMsg(info);
            Utility.readTaskIds();
        }
Ejemplo n.º 2
0
        public void sync()
        {
            Sync   sync_instance = new Sync("sync");
            string s             = JsonMapper.ToJson(sync_instance);

            StandardIO.sendMsg(s + "\n");
        }
Ejemplo n.º 3
0
        public void fail(string s)
        {
            Fail   f    = new Fail("fail", s);
            string info = JsonMapper.ToJson(f);

            StandardIO.sendMsg(info + "\n");
        }
Ejemplo n.º 4
0
        public void ack(string s)
        {
            Ack    a    = new Ack("ack", s);
            string info = JsonMapper.ToJson(a);

            StandardIO.sendMsg(info + "\n");
        }
Ejemplo n.º 5
0
        private void log(string s)
        {
            Log    l    = new Log("log", s);
            string info = JsonMapper.ToJson(l);

            StandardIO.sendMsg(info + "\n");
        }
Ejemplo n.º 6
0
        //protected Queue<Tuple> tuple_queue = new Queue<Tuple>();
        public void initialComponent(Conf config, Context context)
        {
            string           information = StandardIO.readMsg();
            InitialHandshake handshake   = InitialHandshake.Parse(information);

            config  = handshake.conf;
            context = handshake.context;
            int process_id = Process.GetCurrentProcess().Id;
            PID temp       = new PID();

            temp.pid = process_id;
            string json_pid = JsonMapper.ToJson(temp);

            try
            {
                string dir_path = @handshake.pidDir;
                System.IO.Directory.CreateDirectory(dir_path);
                string file = handshake.pidDir + @"\" + process_id.ToString();
                if (!System.IO.File.Exists(file))
                {
                    System.IO.FileStream f = new System.IO.FileStream(file, System.IO.FileMode.CreateNew);
                }
            }
            catch (Exception e)
            {
                // do nothing
            }
            StandardIO.sendMsg(json_pid);
        }
Ejemplo n.º 7
0
        private void initialComponent(Conf config, Context context)
        {
            string           information = StandardIO.readMsg();
            InitialHandshake handshake   = InitialHandshake.Parse(information);

            config  = handshake.conf;
            context = handshake.context;
            int process_id = Process.GetCurrentProcess().Id;
            PID temp       = new PID();

            temp.pid = process_id;
            string json_pid = JsonMapper.ToJson(temp);

            StandardIO.sendMsg(json_pid);
            string file = handshake.pidDir + "/" + process_id.ToString();

            if (!System.IO.File.Exists(file))
            {
                System.IO.FileStream f = new System.IO.FileStream(file, System.IO.FileMode.CreateNew);
            }
        }
Ejemplo n.º 8
0
 public void emit()
 {
     StandardIO.sendMsg(JsonMapper.ToJson(this) + "\n");
 }